Hi Everyone, can anybody throw some light on the below code,
I am trying to get the vba to msgbox out the contents of each cell headers which are in the first row and then stop, at the moment it runs on to the next rows msgboxing those cell contents also ...many thanks in advance
I am trying to get the vba to msgbox out the contents of each cell headers which are in the first row and then stop, at the moment it runs on to the next rows msgboxing those cell contents also ...many thanks in advance
VBA Code:
Sub PrintToImmediateWindowEach()
Dim example As Range
Dim last_col As Variant
last_col = Cells(1, Columns.Count).End(xlToLeft).Column
last_col = Split(Cells(1, last_col).Address, "$")(1)
Set example = Range("A:" & last_col)
For Each example In Range("A:" & last_col)
MsgBox example
Next
End Sub