View Full Version : Sleeper: Populating Ranges
austenr
06-24-2005, 08:06 AM
How does the program populate a range? For example, say you have a range A1 : D100 and you do not use a statement like LastRow or LastColumn. Is the default row by row or column by column. Not having any problem just curious.
:hi:
austenr
06-24-2005, 08:08 AM
Oops. Meant to start a new thread.
Norie
06-24-2005, 09:40 AM
What do you mean?
austenr
06-24-2005, 10:13 AM
Does it evaluate a column at a time for instance column A1,A2,A3, etc. Or is it by row, A1,B1,C1,D1
Zack Barresse
07-01-2005, 02:59 PM
Hmm, well I don't know of a way to do multiple columns at once. You would have to test individually. Something like ...
Option Explicit
Sub GetLastRowPleaseA()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
MsgBox LastRow
End Sub
Sub GetLastRowPleaseB()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "B").End(xlUp).Row
MsgBox LastRow
End Sub
Sub GetLastRowPleaseC()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "C").End(xlUp).Row
MsgBox LastRow
End Sub
Sub GetLastRowPleaseD()
Dim LastRow As Long
LastRow = Cells(Rows.Count, "D").End(xlUp).Row
MsgBox LastRow
End Sub
While this may not be pragmatic for testing mutliple selections, you may be able to incorporate a UDF of sorts, possibly like this .. http://www.vbaexpress.com/kb/getarticle.php?kb_id=496 . Although instead of using the .Cells, set it as a variable set by Range. A possibility.
brettdj
07-01-2005, 03:02 PM
A For ... Each loop processes A1, B1, C1 etc
Cheers
Dave
Zack Barresse
07-01-2005, 03:11 PM
Don't you think the Find method would be faster Dave? .. if performed on a specified range?
brettdj
07-01-2005, 03:58 PM
Don't you think the Find method would be faster Dave? .. if performed on a specified range?
Hi Zack,
For sure, and you can of course specify whether to find by column or row
But I thought the question was how does Excel process data, by row or by column ?????
Cheers
Dave
sheeeng
07-03-2005, 08:20 AM
This is a great KB.
Take a look at it....
Using Functions to Get a Range
http://www.vbaexpress.com/kb/getarticle.php?kb_id=496
HTH.
finally my 200th post...
MOS MASTER
07-03-2005, 08:24 AM
http://www.vbaexpress.com/kb/getarticle.php?kb_id=496
finally my 200th post...
Same Link posted in thread by Zack! :*)
sheeeng
07-03-2005, 09:11 AM
Same Link posted in thread by Zack! :*)
I know, thx.
Just to promote the use of KB here where is possible...:friends:
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.