Last word on the sheet

DDH

Well-known Member
Joined
Sep 25, 2003
Messages
513
I am trying to modify this code to take me to the last word or row on a
sheet, the code below will only do it in row B.
Thank you for your help.



Sub LastCellInColumnxx()
Range("b65536").End(xlUp).Select
ActiveCell.Offset(2, 0).Select
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
15,197
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
This?
Code:
Sub LastCell()
ActiveCell.SpecialCells(xlLastCell).Select
End Sub
 
Last edited:
Upvote 0

DDH

Well-known Member
Joined
Sep 25, 2003
Messages
513
MARK858 - Thank you for the code.

I tried it and it works perfect, but I have a question.
It put a word in column C, Row 75 and put the curser
on Row A, Cell 1 and clicked the macro and it took me to
Column V, Row 75 instead of Column C.
I put a word in Column E, Row 100 and it done the same thing,
it went to Column V .
The last column I have anything in before Column E, Row 100 is
Column P, Row 70.
Thank you for your help.
 
Upvote 0

DDH

Well-known Member
Joined
Sep 25, 2003
Messages
513
I found it.

Sub Demo()
Cells.Find(What:="*", After:=[A1], SearchDirection:=xlPrevious).Select
End Sub


Thank you for your help.
 
Upvote 0

MARK858

MrExcel MVP
Joined
Nov 12, 2010
Messages
15,197
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
Glad you found an answer.Just to answer your question about the SpecialCells(xlLastCell) not going to the right cell, it only resets after a save(or save/close/reopen the file).
This applies also to things like the UsedRange. The other option is to reset it with code. See the thread attached for more info on this. Hope that explains it.
http://www.mrexcel.com/forum/showthread.php?t=73426
 
Upvote 0

Forum statistics

Threads
1,195,632
Messages
6,010,812
Members
441,569
Latest member
PeggyLee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top