View Single Post
  #22   Report Post  
Posted to microsoft.public.excel.misc
GS[_6_] GS[_6_] is offline
external usenet poster
 
Posts: 1,182
Default Excel macro - VBA code query

Garry

Thank you so much for all your hard work. This looks great. However,
when I run the new CopyTitle macro, it only operates on the cell
where
the cursor is - when it's G3, the correct title is inserted for the
top
group of data - but it doesn't do anything on the rest of the
sheet...?

The new macro does all sections on my test sheet, so I suspect you did
not do the defined names correctly.

Should I have mentioned that I'm using Excel 2003 in case that is
relevant?


Here's how to do the defined names for each sheet in xl2003...

Delete all existing names;

Select G3;

Open the Define Names dialog;

Type in the NameBox like this...

'sheet1'!TitleName

..where you need to replace "sheet1" with the actual sheetname;
*Note:* this accounts for the space in the sheetname. I don't use
spaces so I never need to include the apostrophes. Sometimes I'll
use an underscore...
"2016" or "2016_Jan"
"ByDay" or "By_Day"
..for example, so I just have to type "2016!DefinedName"

Tab into the RefersTo field and select the appropriate cell in row4
that contains the title name on that sheet;

Press F2 and use the left arrow key to position to remove the $
symbols so the RefersTo is fully relative;

Click Add and close the dialog.

Repeat for each sheet.

Finally, the merge line is just to improve the overall appearance of
the
data titles.


The title content will span adjacent cells anyway, making them 'appear'
as one cell. Merging isn't necessary, then, to achieve the desired
appearance. Additionally, the span adjusts automatically to the length
of the title name.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion