Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VBA Range using Active.cell.column and range of rows

Tags:

range

excel

vba

I have a statement:

Range("C4:C6").Value = "No"

And I need the column letter to be defined using.ActiveCell.Column and all is fine when I have a range of one specific row, which would be like:

Cells(4, ActiveCell.Column).Value = "No"

But how do I write "Range("C4:C6")" in the same manner as code above that has .activecell.column

Hope someone can help me?

like image 288
Eduards Avatar asked Dec 18 '25 21:12

Eduards


1 Answers

Try:

Range(Cells(4, ActiveCell.Column),Cells(6, ActiveCell.Column)).Value = "No"

This would be equivalent to range starting at row 4 and ending in whatever column is Activecell, but row 6.

like image 112
Foxfire And Burns And Burns Avatar answered Dec 20 '25 16:12

Foxfire And Burns And Burns



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!