Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Help with LastRow

I need help modifying the following code:

Sub Test()

With ActiveSheet
Range("a" & ActiveCell.Row).Offset(1, 0).Select
End With

End Sub

I have data in column "a" and I need the code above to execute until it reaches
the last row. The range is variable based on the data I import from another
file. Is this doable?

Thanks,

James
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Help with LastRow

JStone0218,

I have plagiarized this from J.E. McGimpsey


For Each cell In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)

Do whatever it is you want to do on your column A of data.

Next cell

The For Each statement says in effect,

Start in A1,
Count the number of rows
now xlUP from the bottom (number of rows)

So you have defined the bottom row.

Hope that helps.

Regards,
Kevin

"JStone0218" wrote in message
...
I need help modifying the following code:

Sub Test()

With ActiveSheet
Range("a" & ActiveCell.Row).Offset(1, 0).Select
End With

End Sub

I have data in column "a" and I need the code above to execute until it

reaches
the last row. The range is variable based on the data I import from

another
file. Is this doable?

Thanks,

James



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Help with LastRow

Hello James,

'You can use .SELECT instead of Application.Goto
Application.Goto Range("A65536").End(xlUp).Offset(1)
or

Application.Goto Cells(Rows.Count, 1).End(xlUp).Offset(1)

I think it is faster than looping cells.


--
Kind Regards
Colo
/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
Colo of 'The Road of The Cell Masters' :)

URL:http://www.interq.or.jp/sun/puremis/...astersLink.htm


/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/


"JStone0218" wrote in message
...
I need help modifying the following code:

Sub Test()

With ActiveSheet
Range("a" & ActiveCell.Row).Offset(1, 0).Select
End With

End Sub

I have data in column "a" and I need the code above to execute until it

reaches
the last row. The range is variable based on the data I import from

another
file. Is this doable?

Thanks,

James


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default Help with LastRow

Kevin,

Thanks, this worked great!

James

"Kevin Stecyk" wrote in message
...
JStone0218,

I have plagiarized this from J.E. McGimpsey


For Each cell In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)

Do whatever it is you want to do on your column A of data.

Next cell

The For Each statement says in effect,

Start in A1,
Count the number of rows
now xlUP from the bottom (number of rows)

So you have defined the bottom row.

Hope that helps.

Regards,
Kevin

"JStone0218" wrote in message
...
I need help modifying the following code:

Sub Test()

With ActiveSheet
Range("a" & ActiveCell.Row).Offset(1, 0).Select
End With

End Sub

I have data in column "a" and I need the code above to execute until it

reaches
the last row. The range is variable based on the data I import from

another
file. Is this doable?

Thanks,

James





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Help with LastRow

Hi Donnie,

You are most welcome--glad it worked for you.

Regards,
Kevin


"Donnie Stone" wrote in message
...
Kevin,

Thanks, this worked great!

James

"Kevin Stecyk" wrote in message
...
JStone0218,

I have plagiarized this from J.E. McGimpsey


For Each cell In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)

Do whatever it is you want to do on your column A of data.

Next cell

The For Each statement says in effect,

Start in A1,
Count the number of rows
now xlUP from the bottom (number of rows)

So you have defined the bottom row.

Hope that helps.

Regards,
Kevin

"JStone0218" wrote in message
...
I need help modifying the following code:

Sub Test()

With ActiveSheet
Range("a" & ActiveCell.Row).Offset(1, 0).Select
End With

End Sub

I have data in column "a" and I need the code above to execute until

it
reaches
the last row. The range is variable based on the data I import from

another
file. Is this doable?

Thanks,

James







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
Lastrow Bishop Excel Worksheet Functions 2 May 13th 09 05:22 PM
Lastrow Mr. Damon[_2_] Excel Worksheet Functions 3 July 30th 08 04:12 PM
HELP Lastrow Range Mr. Damon Excel Discussion (Misc queries) 1 July 29th 08 01:21 PM
LastRow of Data phmckeever Excel Worksheet Functions 1 December 1st 06 09:04 PM
Lastrow in Range Jeff Excel Discussion (Misc queries) 2 December 17th 04 04:53 PM


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