Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 269
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default 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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default 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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
divide column(x) by column(y) to give column(x/y) in excel? James New Users to Excel 2 April 24th 23 11:46 AM
Referencing date column A & time column B to get info from column TVGuy29 Excel Discussion (Misc queries) 1 January 24th 08 09:50 PM
Return text in Column A if Column B and Column K match jeannie v Excel Worksheet Functions 4 December 13th 07 07:36 PM
Based on a condition in one column, search for a year in another column, and display data from another column in the same row look [email protected] Excel Discussion (Misc queries) 1 December 27th 06 05:47 PM
How can i have all alike product codes in column A be matched with like cities in column B and then add the totals that are in column C [email protected] Excel Programming 4 August 2nd 06 01:10 AM


All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"