Excel 2010 Macro to Do something to a Dynamic Range

‘VBA Excel Training Classes and Courses in New York City, NYC
“Feel free to contact us about Excel Online VBA Training Classes

Sub OnlyDoIfValue()
Dim lastrow As Long, mycell As Object

‘Find the last row in Excel

Range(“a65000″).End(xlUp).Select
lastrow = ActiveCell.Row

‘Define the Dynamic Range
Set myRange = Range(“b1:b” & lastrow)

For Each mycell In myRange
‘Puts in something to the right of the range

mycell.Offset(0, 1) = “Something”
Next
End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>