![]() |
Row & Column
I'm trying to find some code that will return the row number of a variable
'Val' as 'j' and the column as 'i'. For example Call A1 i=1, j=1 I've tried the row command but i'm not having much luck... Any help appreciated. -- Dave |
Row & Column
Sub GetRowAndCol()
Dim j As Long, i As Integer, adr As String adr = "A1" j = Range(adr).Row i = Range(adr).Column MsgBox j & " " & i End Sub By the way, are you saying you're using Val as a variable name? Val is a keyword, of course, so I wouldn't use it for a variable name. James DaveyJones wrote: I'm trying to find some code that will return the row number of a variable 'Val' as 'j' and the column as 'i'. For example Call A1 i=1, j=1 I've tried the row command but i'm not having much luck... Any help appreciated. -- Dave |
Row & Column
Cheers, thats got it sorted. As for the keyword, I can't say I knew that, i'm
a complete newbie at this... -- Dave "Zone" wrote: Sub GetRowAndCol() Dim j As Long, i As Integer, adr As String adr = "A1" j = Range(adr).Row i = Range(adr).Column MsgBox j & " " & i End Sub By the way, are you saying you're using Val as a variable name? Val is a keyword, of course, so I wouldn't use it for a variable name. James DaveyJones wrote: I'm trying to find some code that will return the row number of a variable 'Val' as 'j' and the column as 'i'. For example Call A1 i=1, j=1 I've tried the row command but i'm not having much luck... Any help appreciated. -- Dave |
Row & Column
i= myVar.Row
j = myVar.Column this assumes myVar is a range variable -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "DaveyJones" wrote in message ... I'm trying to find some code that will return the row number of a variable 'Val' as 'j' and the column as 'i'. For example Call A1 i=1, j=1 I've tried the row command but i'm not having much luck... Any help appreciated. -- Dave |
All times are GMT +1. The time now is 01:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com