View Single Post
 
Old 02-22-2020, 08:04 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Windows XP Office 2007
Competent Performer
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 234
Jennifer Murphy is on a distinguished road
Default

It just occurred to me that there would be no need to pass a parameter to declare the number of header rows if the macro could test for it. After a little research, I came up with this code, which seems to work:

Code:
Dim Row as long
With Selection.Tables(1)              
  'Skip over any header rows
  For Row = 1 To .Rows.Count
    If .Rows(Row).HeadingFormat <> -1 Then
      Exit For
  Next Row
Are there any problems with this code or is there a better way?

Last edited by Jennifer Murphy; 02-22-2020 at 08:26 AM. Reason: Typo: Change "=" to "<>"
Reply With Quote