Close Window
Free Ebook
Get Your Free Excel
Top 15 Excel Tutorials from
Instant Access!

Hide/unhide Lines On Chart

I have a chart on the same page as the source data. The chart has five lines, and the user needs the option to select which lines to show. I would like to show check boxes beside each row of data. The user would be able to hide/unhide each line as needed. I have tried the following statements:

Sub Macro1()
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Hidden = True
End Sub

There are no errors when I compile, but I get an error on the last statement at runtime. Any help would be appreciated. Is there a better way to accomplished this objective

Free Excel Courses

Similar Excel Tutorials

I'll show you how to hide worksheets in Excel so that a user cannot see them but you can still access data on them ...

In Excel you can actually hide data that is stored within a worksheet. This allows you to show data that is useful ...

This is how you prevent a chart from appearing when you print from Excel. This is a great feature when you want to ...

How to show data from hidden rows and columns on a chart in Excel. When you hide rows or columns of data, a chart ...

Helpful Excel Macros

- This macro will pull the values from a chart in excel and list those values on another spreadsheet. This will get the s

- Create a line chart in Excel with this macro. This allows you to quickly and easily create line charts and graphs from

- This macro adds a column chart to Excel. This is an easy to use macro that allows you to quickly chart and graph a rang

- Delete all chart sheets and tabs in Excel using this macro. This will only delete the charts and graphs that are in the

- Create a bar chart in Excel with this macro. You will be able to quickly and easily turn any range of numbers and data

Similar Topics

Hi. I have a row in a spreadsheet in Excel that is hidden but i am unable to unhide it. I have tried the usual way by hovering between the rows above and below until i get the double line but this does not happen. I have also tried going through the Format - Row - Unhide option but this also doesn't work. Any suggestions?

I have an Excel workbook that was created by a former coworker. It includes a macro that, among other things, displays a message box about the 2008 file. The macro runs as soon as the file is opened. I'd like to access that macro to correct the date to 2011 and see what else, if anything, it's doing for me (it doesn't appear to do much). I can find references to creating macros to hide and unhide rows/columns and I found ways to delete all macros in a workbook, but I cannot find anything about unhiding a macro without knowing its name.

Does anyone know of a way to unhide this macro?


I have a pivot chart with a bunch of data series, and every time we
include/exclude one of the series to see how the chart changes, all the
colors change and we have to spend time re-identifying which series is
which, using the legend to check the colors.

Is there a way to "lock" the colors, so that the bars stay the same colors
regardless of whether other bars are included/excluded?


I have a problem: I can't show some rows after they've been hidden with a macro. I tryed the "select all / unhide", but it doesn't work.

I noticed the row numbers are all blue now. What does it mean? (This could be the answer..:P)

Seemingly super simple, but I can't figure it out.

When I create a bar chart, the bars are horizontal. I want the chart bars to be vertical. It tried to rotate the chart so that it is vertical, but the "rotate" options are greyed out.

How do I get those bars vertical?

I have a workbook that I have unprotected (all - workbook & worksheets). However, I have a sheet that I know is there (because I created it) but I cannot unhide. I know it is there because in the Name Manager, it points to it. Any idea how I can unhide it?

Hey everyone,

I'm really hoping someone can help me with this...

I need to plot percentages over time in a line graph in excel. I don't want to have to do a percentage equation in the spreadsheet, I just want excel to take two sets of values and display the percentage in the chart. For example, I need B1 as a percentage of B2 for week 1, C1 as a percentage of C2 for week 2, etc....
Can someone please offer a suggestion for how to do this? I would really appreciate it.
Also, would it be possible to link data from other sheets in the workbook into one single chart?

Hello -

I am using Excel 2007. In prior versions of excel, when copying data, if I wanted to copy visible cells only, I would select "Go To, Special, Visible Cells Only" and then copy a range a cells. The default was always set to copy everything (including hidden cells), unless I specifically selected copy visible cells only.

In 2007, the default is somehow set to always copy only visible cells. Sometimes, I want to be able to copy all cells including those hidden but cannot seem to figure out how to swith this default option. I looked under Excel Options and did not see an option there.

I don't want to have to unhide and rehide everything each time i copy. I know i could do the hiding and unhiding via VBA but would prefer not to have to.

Thanks for your suggestions.

I have a merged cell which contains a text with multiple lines.
I want to split the lines into multiple rows.Each line should come in a different row.
I want to do this using macro.Is there is anyway to do this?
There is an option to split the cell into multiple cells on the basis of the delimiter, but there is no option to split them into rows.

I'm trying to separate bars inside a bar chart into separate groups. Adjust the gap applies to all bars. How will I be able to achieve what I need? Please help and thanks

I have a textbox in my userform where anything typed in the box is entered into cell A2 in my worksheet. However, multiple lines of text are not properly displayed in my worksheet. I have enabled MultiLine and EnterKeyBehaviour in the properties window of the textbox so I can type multiple lines in my textbox. The problem is that when I press the button to enter the text from my txtbox to cell A2, the cell doesn't actually display the text in separate lines. It just places a square symbol in the place that enter should have been pressed and the text should have been split into separate lines.

How can I get the separate lines of text in my textbox to be properly displayed in a cell? Thanks for your help in advance..

Hey there,

I have been tasked with introducing userforms into an excel sheet and tbh I'm quite amazed that excel has this capability of adding userforms to excel sheets.

Anyway, I have 2 columns of data in an excel sheet and I wish to add this to a userform so that the userform displays the 2 columns beside each other with headings, like a table. The user should then be able to select a particular row and insert it into the specified cell.

I would also like the user to select a row on the table and then be able to bring up another table depending on the row selected...basically so that the user can draw deeper into the information that they require.

I have an example excel sheet where I have 2 sheets. One sheet is the user entry sheet called User Entry Screen. the next sheet is the tables sheet where my tables are held. Once the user selects the cell shown in the example sheet, it should then bring up the user form. the user then, depending on which item clicked, then gets shown the next window with a table and info on it. then user should then be able to select an item and the cells on the user entry screen would then get populated.

Personally I think this is a really tricky challenge and any help with doing this would be extremely appreciated.

I'll post up further comments as I am trying to work my way through it!



Corporate edict.

I have a worksheet that is locked and protected now, except for cells in a certain collumn. I have named the cells in that column "MS96A".

If a user enters a date in a cell or range of cells anywhere in the column, the changed cells also need to be locked and protected (Once they enter a date, it is not allowed EVER to be changed again. Corporate requirement! *Shrug*).

What I am looking for is this. If the user selects that cell again, they will get the usual pop-up message, "The cell or chart that you are trying to change is protected..."

I think I am close, but I am getting an "End If without block If" error on the If Clause.

Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim MRange As Range
Set MRange = Range("MS96A")
' If Not Intersect(Target, MRange) Is Nothing Then For Each cell In MRange Sheets("Sheet1").Unprotect Password:="temp"
cell.Interior.ColorIndex = 3
cell.Font.Color = vbBlack
Selection.Locked = True
Selection.FormulaHidden = False
Next cell
ActiveSheet.Protect Password:="temp", _
DrawingObjects:=False, _
Contents:=True, _
ActiveSheet.EnableSelection = xlUnlockedCells
End Sub

I need to create a bar chart for the year. I've already have 3 bars for each of the months, a plan, an actual, and a last year. I need to be able to split out just the actual bar, so that it is a stacked bar. The other two bars need to stay and remain unstacked. Is this possible?

Hi there! This is definately a quick question, but I need to select a range. I'm looking to do so along these lines:

Range("Activecell.End(xlDown)", "Active.End(xlToRight)").Select

This is definately a problem of not knowing the right jargon to do so.

Could someone please assist?

Thanks in advance!

Some time ago I created a spreadsheet and greyed out the areas that weren't needed. Now I need to expand the spreadsheet and use more columns. Trouble is I've forgotten how to unhide those columns. I didn't write any macros and usings the right-click unhide method is proven futile. The sheet isn't protected which is puzzling since I can't get the mouse to even highlight any of the greyed out areas.

Any suggestions would be fantastic!

I have a requirement to change the panes in excel.
My excel file will contain more than one tab.
I have to free the first two lines in all the tabs except the first one.
I tried the following code.


ActiveWindow.FreezePanes = True

But in this I have to change the Active Worksheets in VBA, Which I want to avoid.
Is there any method to achieve this without selecting the cells.
Something like

xlsobj.Worksheets(1).Rows("1:2").FreezePanes = True

I saw two threads in this forum that asked this question, with no good answer. I am posting this solution for anybody still struggling with this.

The question:
How can you prevent a cell's contents from overflowing into the next cell?

Of course, you can make the column wider or turn on text wrapping, but you might not want to. Each of those solutions can mess up the layout of your sheet. You may just want to truncate the value.

Some people have suggested putting a space in the next cell. This is unnecessary, a pain in the but, and will mess up any ISBLANK type formulas, among other things.

The solution:
Select the cells in question and turn on text wrapping (Format>Cells>Alignment>Wrap Text).
Now select the row(s) in question and manually set the row height, by right clicking the row number and selecting "Row Height". Check the height of an adjacent row for a good value.

Your cells will now not spill over either horizontally or vertically. They will simply truncate anything that doesn't fit.

Be careful now, because parts of your data may be hidden. This can cause its own set of problems if one or two digits are neatly hidden away. Think ahead if other people might be using this sheet, and not be expecting to have some data hidden.

Tested in Excel 2002


Firstly i haven't used excel to a great extent since my college days. So i'm having to re-learn 99.9% of everything i once new...

I am volunteering for a non profit organization and trying to create a reservation system for the rooms that they have - kind of like hotel software, but in excel (i did a similiar thing in college but for plane seats)

Please find it attached.

What i need it to do:

Copy all of the info from the main page to the guest lit (a new row each time).

From the guest list to the Gannt chart - i did a few tutorials on dynamic gantt charts using conditional formatting but cannot get them to work when based on data on a different worksheet.

Finaly is there a way to check for availabilty on any given date?

if just someone could point me in the right direction, i would be appreciate it so much words can't express!!!

Best Regards,


P.S for the calender drop down on the main page, i'm using 'microsoft time & date picker 6.0)

/ - pop ups on this site

/ - same file, better website

I have an extensive spreadsheet with several columns and all showing borders
where each cell/column begins and ends. However there are a few cells where
the break with the next cell does not show the line.

I have highlighed the cell in question, gone to format/cell/borders and
everything looks fine. Black color + format border shows square with all
sides of square showing.

Any thoughts on how to fix these few random cells.



I need vba code to Select first visible cell below the header row after applying autofilter on column Q of the data. Can somebody help me on this?

I tried


but it does not work. Probably because column Q is filtered to show only blank cells,

Can somebody help me on this?


I am a very advanced Excel user so this is a new one for me.

When I open any spreadsheet (new or already populated) the black box that normally frames the active cell is missing (showing which cell you have selected). Likewise when I 'select all' the sheet does not become shaded.

In addition:

Can not fill series
Can not change cell format (specifically to show Currency or Accounting w/$ symbol)

And I am sure there is much more that I have not found yet. I have not seen a single thread on this topic anywhere on the internet.



I am using


in a piece of VBA and it causes an error if the sheet does not have a filter applied! Is there an if statement I can use to check if the data is filtered?

Thanks - this site is an absolute life saver!


I am looking for the code to select the visible data after applying a data filter. Actually I know how to select the data after applying the data filter but the issue is I am not able to exclude the header row and give the target range as used (non-blank) rows only!!

I am using below code to Select the Visible rows in the target range:



Problems in this code a

1) after applying the filter, while selecting the data it is selecting all the rows in given range till last row on the workbook. I need this to select the the data only till the last used row in the given range.

2) It is not possible to provide the address of the first row after we apply the filter since the first row address may change depending on the values in the table.

E.g. 1st time when I am running the macro the first row in the visible filtered data is starting at Cell address A4 and next time when I will run the macro it may be A6

3) The Code is also selecting the 1st row which is a header row. How can we exclude it from selection.

Some one please revert with the solution.
Thanks in advance.

I have been using Excel (XP) to make a text chart for several months. Some of
my text entries are rather lengthy. The past two weeks these lengthy entries
are showing up as pound signs (#########) when I click off the cell. I know
the text will fit in the cell, and the problem isn't solved by making the
cell bigger or using a little bit less text. I have the cells formatted as
"text" and "wrap to fit". I have printed the pages and the printed version
also has pound signs. I just want my text to show up!

Related pages

how to calculate date difference in excel 2007vba findfirstprimo pdf command line parametersqfx filessumproduct with multiple criteriacalendar input excelstock register format in excelexternal table is not in the expected formatexcel vba lookup valueexcel formula to change cell color based on textexcel macro sortvacation tracker spreadsheetmathcad appvba remove duplicates from arraydate picker in excel 2007export microsoft outlook calendar to excelvba excel usedrangeconsolidate worksheets in excelexcel sudokuamortization calculation formulaexcel generate histogramtraining database template excelpublic variable vbapayroll deduction calculator bcworking out pro rata holiday entitlementattendance tracker excelexcel vba autofilterword conditional formattingcalculate julian date formulavba code libraryhow to record a macro in excel 2007how do i insert a checkbox in excelweighted avg in excelmark duplicates in popupshortcut key for format painter in excelnon repeating random number generatorpowerpoint icon missingcalculating sharpe ratio in excelmsgbox vba excelexcel seating plan templatevba infoboxselling excel spreadsheetslinking excel to powerpointexcel automatic calendarpst manilaconverting pst to istcalculating percentage change in exceledtesthow to highlight duplicate values in excelschema iniexcel split panevba print commandpercentage increase decrease formulaall possible combinations of 4 lettersarc length solverpivot table custom formulaexcel macro last rowvba left stringexcel stacked clustered bar charthow to wrap columns in excelexcel columns missinginsert signature excelhi fellasconvert degrees to percent slopedivide columns in excelworkdays per monthhow many rows and columns in excel 2007how can i unhide columns in excelmicrosoft word overlineaccess macro to import excel filems access dcount multiple criteriavba character codesmilitary time calculator in excelwhat is 15 minutes on a timesheeterlang c online calculator