LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Easy VBA question: range control

I know this sounds easy, but I'm new to VBA and I haven't been able to solve
it successfully:

In a VBA IF-THEN-ELSE statement, how do I specify a range that includes
column A from cell A2 to the last non-empty column?

Here's my existing code:

Sub aaaa
Column ("A:A").Select
For Each cell in Selection
If cell.Value 0 Then cell.Offset(0, 1) = "string1"
Else cell.Offset(0, 1) = "string2"
End If
Next Cell
End Sub

This code works, but fills the entire Offset column, all 65,000+ rows. I
only want to to fill the first 1000-1500 rows, depending on how many rows in
the worksheet have data.

Thanks in advance.

-jbb


 
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
Hopefully an easy question Yookaroo Excel Worksheet Functions 4 July 7th 09 08:31 PM
*EASY* question 2!! Laura \( '_' \) New Users to Excel 3 November 25th 05 02:01 PM
*EASY* question! Laura \( '_' \) New Users to Excel 3 November 25th 05 12:02 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM
MultiPage control: Easy question SC Excel Programming 2 January 8th 04 08:54 PM


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

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

About Us

"It's about Microsoft Excel"