LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Macro to insert headers..need coding help

Mary,

Do the cells that are to act as triggers to insert the header contain
text (i.e., "02")? If so then change the test from
if cells(counter,1)=2
to
if cells(counter,1)="02"

Also, is the intent to process one worksheet at a time? or one workbook
with more than one worksheet and process all of the worksheets within
the one workbook? If processing all worksheets within one workbook, you
need to loop through all worksheets making each worksheet active in
turn then run the test for the "01" and "02" as Cells only works on the
active worksheet. The following is an excerpt from Excel 2000 help for
the Cells property:
"Using this property without an object qualifier returns a Range
object that represents all the cells on the active worksheet."

You might consider something like

For Each ws In ActiveWorkbook.Worksheets
If ws.Cells(counter, 1) = "02" Then AddHeader2
Next

HTH,

Art

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Way to insert a footer in an entire workbook w/o altering headers Deb Excel Discussion (Misc queries) 2 April 7th 09 09:13 PM
Insert work sheet with Custom headers DHM Excel Discussion (Misc queries) 4 July 12th 07 03:24 AM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
VBA-How to insert vba code file in a project using coding rather than manual import Excel4Engineer[_2_] Excel Programming 1 February 9th 04 05:09 PM
Coding a button or hyperlink to insert a predfined row Neal Miller Excel Programming 0 December 3rd 03 10:11 PM


All times are GMT +1. The time now is 06:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"