Refer to .Row or .Column

drom

Well-known Member
Joined
Mar 20, 2005
Messages
543
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and thanks in advance!

I am using the following line of code:

VBA Code:
For X = ActiveCell.Row To 1 Step -1
For X = ActiveCell.Column To 1 Step -1

and inside the For ... Next, many lines of code, but the only thin I change inside the For Next is when I refer to

.EntireRow.Hidden Then
.EntireColumn.Hidden Then
Activecell.row ...
Activecell.column ...

Is there any way of doing:

Call MyMacro (wColumnOrRow as string, wEntireColumnOrRow as string)

and then use:
  • For X = ActiveCell(wColOrRow) To 1 Step -1

I do not want to use inside the for Next kind of:
'if then else
I am tryng to know if is possible to refer to .Column or .Row using a variable kind of:
debug.print Activecell(indirect(wColumnOrRow)) or ???
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Weird request (;)), but yes, you can use CallByName - for example:

Code:
callbyname(activecell, "Row", VbGet)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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