468,554 Members | 1,946 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,554 developers. It's quick & easy.

Excel Macros

What is the problem with the macro : below

Expand|Select|Wrap|Line Numbers
  1. Sub M()
  2.  
  3. C = Worksheets("SHEET1").Range("B5")
  4. C = ActiveCell
  5. My_row = ActiveCell.Row
  6.  
  7. End Sub
I would like that excel give me back the information of My_Row=5, because that is the row of the Range B5. How can I do this?

:confused:
Aug 28 '06 #1
2 2334
Hello eduardo,

Try this:

Expand|Select|Wrap|Line Numbers
  1. C = Worksheets("SHEET1").Range("B5").Select
  2. C = ActiveCell
  3. My_row = ActiveCell.Row
Nice regards,
Michelle.
Aug 28 '06 #2
: below


I would like that excel give me back the information of My_Row=5, because that is the row of the Range B5. How can I do this?

:confused:
Expand|Select|Wrap|Line Numbers
  1. Sub M()
  2.  
  3. C = Worksheets(1).Range("B5").Address
  4. My_Row = Range(C).Row
  5.  
  6. MsgBox C       ' you may remove these two lines when finished testing
  7. MsgBox My_Row  ' you may remove these two lines when finished testing
  8.  
  9. Range(C).Offset(0, 0).Value = C & ", " & My_Row 
  10. ' modify the (0, 0) to read (0, 1) for example, and you can see the result being placed to the right of the C range instead of within it
  11.  
  12. End Sub
  13.  
  14.  
you can now modify this in your choice of ways, to arrive more closely at the result you wanted.
Sep 4 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by jeremy.bird | last post: by
6 posts views Thread by Duncan Smith | last post: by
8 posts views Thread by =?Utf-8?B?SmVycnkgQw==?= | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.