View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy[_17_] Tom Ogilvy[_17_] is offline
external usenet poster
 
Posts: 1
Default If-Then statement with variable range

Typo?

Yes

Set rng = Range("A1").Current.Region

should be

Set rng = Range("A1").CurrentRegion

as pointed out by Anders.

--
Regards,
Tom Ogilvy



Tom Ogilvy wrote:
*If there are no empty rows or columns within the data

Dim rng as Range
set rng = Range("A1").Current.Region


If you have a particular column you want to look at (for example, the
3rd column, column C)

lastrow = Cells(rows.count,3).End(xlup).row

and if row1 can be used to determine the number of columns

lastColumn = cells(1,columns.count).end(xltoLeft).Column

set rng = Range(Range("A1"),Cells(LastRow, LastColumn))

--
Regards,
Tom Ogilvy *



---
Message posted from http://www.ExcelForum.com/