Display a message box which displays cell address of the last populated cell in a row and jumps to 'it' when user clicks “ yes “ button
I am a complete novice to VBA. Is there a cleaner way to write some VBA code performing the following function?
When macro is run:
- Displays popup message box with text.
- Runs string of VBA code which returns cell address of last populated cell in column "A" and displays it as follows: "Last Populated Cell Is: [Cell Address] Jump To The Last Cell?"
- Gives user chose of "Yes" or "No"
- If user choose YES = Jumps to last populated cell.
- If user choose NO = macro ends and pop box disappears.
Here is my code at present:
Code
Sub MsgBox_LastPopulatedCell()
Dim result As VbMsgBoxResult
result = MsgBox("Last Populated Cell Is:" & Chr(32) & Range("A65536").End(xlUp).Address & vbCrLf & "Jump To The Last Cell?", vbYesNo + vbQuestion, "Joshua Excel Tools" & Chr(32) & Chr(169))
Select Case result
Case 6
Range("A65536").End(xlUp).Select
Case 7
ActiveCell.Range("A1").Select
End Select
End Sub
Display More