Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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/

Reply
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
Variable in if statement Francis Hookham Excel Worksheet Functions 9 December 12th 07 02:35 PM
Variable in Range statement Mike Excel Programming 2 December 14th 03 04:08 AM
Problem trying to us a range variable as an array variable TBA[_2_] Excel Programming 4 September 27th 03 02:56 PM
Case statement in variable range TP[_3_] Excel Programming 1 August 23rd 03 05:14 PM
Passing a variable to a range statement Mervyn Thomas[_3_] Excel Programming 3 July 25th 03 02:40 PM


All times are GMT +1. The time now is 09:19 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"