Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 9
Default Selecting the first cell of the last row in a range

A co-worker asked me how to programmatically select the first cell of the
last row in a range in Excel 2003 (Windows XP). We found the Help reference
to selecting the last cell in a range, but we couldn't come up with a good
solution for the first cell in the last row, other than a "SendKeys" type of
solution to send "Ctl-down arrow", which is a bit too imprecise.

Neither of us is a strong coder, but he's trying to use a macro to get
there.

Any ideas would be welcome!

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**


  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Selecting the first cell of the last row in a range

This will find the last row on the active sheet and then select col A in
that row.

Sub firstcelloflastrow()
lr = Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Row
'MsgBox lr
Cells(lr, 1).Select
'or
'Cells(lr, 1).End(xlToRight).Select
'to goto the first non blank cell on THAT row

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Susan Ramlet" wrote in message
...
A co-worker asked me how to programmatically select the first cell of the
last row in a range in Excel 2003 (Windows XP). We found the Help
reference
to selecting the last cell in a range, but we couldn't come up with a good
solution for the first cell in the last row, other than a "SendKeys" type
of
solution to send "Ctl-down arrow", which is a bit too imprecise.

Neither of us is a strong coder, but he's trying to use a macro to get
there.

Any ideas would be welcome!

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**



  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 9
Default Selecting the first cell of the last row in a range

Thank you, Don! We will put this to use. I appreciate the quick and complete
response.

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**


"Don Guillett" wrote in message
...
This will find the last row on the active sheet and then select col A in
that row.

Sub firstcelloflastrow()
lr = Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Row
'MsgBox lr
Cells(lr, 1).Select
'or
'Cells(lr, 1).End(xlToRight).Select
'to goto the first non blank cell on THAT row

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Susan Ramlet" wrote in message
...
A co-worker asked me how to programmatically select the first cell of the
last row in a range in Excel 2003 (Windows XP). We found the Help
reference
to selecting the last cell in a range, but we couldn't come up with a
good
solution for the first cell in the last row, other than a "SendKeys" type
of
solution to send "Ctl-down arrow", which is a bit too imprecise.

Neither of us is a strong coder, but he's trying to use a macro to get
there.

Any ideas would be welcome!

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**




  #4   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 1
Default Selecting the first cell of the last row in a range


Could you explain why you would want to select the first used cell in a
range or is it the first cell in a range?

Susan Ramlet;295213 Wrote:
A co-worker asked me how to programmatically select the first cell of
the
last row in a range in Excel 2003 (Windows XP). We found the Help
reference
to selecting the last cell in a range, but we couldn't come up with a
good
solution for the first cell in the last row, other than a "SendKeys"
type of
solution to send "Ctl-down arrow", which is a bit too imprecise.

Neither of us is a strong coder, but he's trying to use a macro to get
there.

Any ideas would be welcome!

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=82520

  #5   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 9
Default Selecting the first cell of the last row in a range

He wants to select the first cell of the last row of a range and then format
it programmatically (I don't know the specific objective in the context of
the overall spreadsheet; sorry...).

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**


"Simon Lloyd" wrote in message
...

Could you explain why you would want to select the first used cell in a
range or is it the first cell in a range?

Susan Ramlet;295213 Wrote:
A co-worker asked me how to programmatically select the first cell of
the
last row in a range in Excel 2003 (Windows XP). We found the Help
reference
to selecting the last cell in a range, but we couldn't come up with a
good
solution for the first cell in the last row, other than a "SendKeys"
type of
solution to send "Ctl-down arrow", which is a bit too imprecise.

Neither of us is a strong coder, but he's trying to use a macro to get
there.

Any ideas would be welcome!

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile:
http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=82520




  #6   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 10,124
Default Selecting the first cell of the last row in a range

Selecting is NOT necessary
Sub firstcelloflastrow()
lr = Cells.Find("*", Cells(Rows.Count, Columns.Count) _
, , , xlByRows, xlPrevious).Row
'MsgBox lr

Cells(lr, 1).numberformat=???
or
format(Cells(lr, 1), "mm/dd")
'or
'Cells(lr, 1).End(xlToRight).Select
'to goto the first non blank cell on THAT row

End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Susan Ramlet" wrote in message
...
He wants to select the first cell of the last row of a range and then
format it programmatically (I don't know the specific objective in the
context of the overall spreadsheet; sorry...).

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**


"Simon Lloyd" wrote in message
...

Could you explain why you would want to select the first used cell in a
range or is it the first cell in a range?

Susan Ramlet;295213 Wrote:
A co-worker asked me how to programmatically select the first cell of
the
last row in a range in Excel 2003 (Windows XP). We found the Help
reference
to selecting the last cell in a range, but we couldn't come up with a
good
solution for the first cell in the last row, other than a "SendKeys"
type of
solution to send "Ctl-down arrow", which is a bit too imprecise.

Neither of us is a strong coder, but he's trying to use a macro to get
there.

Any ideas would be welcome!

--
Susan Ramlet
**please reply to the newsgroup so others may benefit**



--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (
http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile:
http://www.thecodecage.com/forumz/member.php?userid=1
View this thread:
http://www.thecodecage.com/forumz/sh...ad.php?t=82520



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
Selecting the value from a randomly selected cell out of a range Steve W. Excel Discussion (Misc queries) 1 June 3rd 08 06:27 PM
selecting multiple cell in a roll that falls withing a range Olamide Charts and Charting in Excel 1 March 15th 07 01:43 PM
Selecting the first non blank cell in Range VBA Noob Excel Worksheet Functions 2 July 24th 06 07:39 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Selecting a cell in a range Coolboy55 Excel Worksheet Functions 0 August 31st 05 07:17 PM


All times are GMT +1. The time now is 11:10 PM.

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"