Compute row and col from letter+number

evert

Board Regular
Joined
Dec 11, 2007
Messages
64
With a VBA dialog, I want the user to type in a cell, for example "E4", and then I want to access
this Cell in VBA - for example
Code:
          Total_amount = Total_amount + Cells(row,col) '  ==> ought te be 4,5
How can I validate the users input and then calculate row and col?

I could imagine that I can write a loop that parses the input, but maybe there's something more straight.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Uf the users have typed in a range eg E4 then you can access both row and column like so:

Code:
strAddress = "E4"

Msgbox "Row is " & Range(strAddress).Row & ", and Column is " & range(strAddress).Column
 
Upvote 0
Thanks!:)

Meanwhile I have found another option:
Code:
     TotalAmount = TotalAmount + Range(strMyRange).Cells(1, 1)
 
Upvote 0
You don't need the Cells bit on the end there you can do it with:

Code:
TotalAmount = TotalAmount + Range(strMyRange)
</pre>
 
Upvote 0

Forum statistics

Threads
1,215,460
Messages
6,124,949
Members
449,198
Latest member
MhammadishaqKhan

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