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

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”
End Sub