Select a cell in column “A” based on its row number.

harzer

Board Regular
Joined
Dec 15, 2021
Messages
157
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,
Via this message, I would like to explain my little problem to you.
I want to select a cell in column "A", based on the row number, let me explain:
How to proceed?
We ask the user to mention the number of the line concerned via an inputbox, when the user has entered the desired line, then we go to the cell in column "A" of the number of the line entered by the user .
Thank you for your contributions.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Like this?

VBA Code:
Option Explicit
Sub test()
Dim ip
ip = InputBox(" Which line do you want?")
If Not IsNumeric(ip) Or ip > Rows.Count Then
    MsgBox "Invalid line number! Try again"
    Exit Sub
End If
Cells(ip, "A").Select
End Sub
 
Upvote 0
Solution
Hello bebo021999,
Thanks for your response, that's exactly what I'm looking for.
The proposed code meets my expectations.
Big THANK YOU to you.
 
Upvote 0

Forum statistics

Threads
1,224,522
Messages
6,179,297
Members
452,903
Latest member
Knuddeluff

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
Back
Top