Any fast method to parse a string into row & col information

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

Hi,

Given a string "AC19", any method to split the string into "AC" and
"19", without using string methods?

Thx

Nick
 
Hard to do anything to a string without using string
methods! (I assume you mean functions).
 
What about the LEFT() and RIGHT() functions? They take a
string expression and get a certain number of charaters
from the left or the right.
 
Nick,

You can use the sub and function below.

HTH,
Bernie
MS Excel MVP

Sub ShowColumnLetter()
Dim myAddress As String
myAddress = "AC19"

MsgBox "Column and row for cell " & myAddress & _
" are " & ColumnLetter(myAddress) & _
" and " & Range(myAddress).Row & "."
End Sub

Function ColumnLetter(myAdd As String) As String
Dim LastColLtr As String
LastColLtr = Range(myAdd).Address
ColumnLetter = Mid(LastColLtr, 2, InStr(2, LastColLtr, "$") - 2)
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top