Set Statements in VBA
Posted by Barry Ward on August 13, 2001 2:49 AM
I'm using an input box to select data for a macro to use but don't know how to select that data once it is set.
If the above sounds cobnfusing it's because I have zero knowledge of VBA and am trying to scratch something together. The relevant section of code is below:
selects header names
Set headers = _
Application.InputBox _
("Select range of cells containing headers:", Type:=8)
If IsObject(headers) = False Then Exit Sub
MsgBox headers.Rows.count
'copies headers new sheet
Selection.Copy
Sheets("Results").Select
ActiveSheet.paste
'selects input data
Set Data = _
Application.InputBox _
("Select range of cells containing the data to be unbinned:", Type:=8)
If IsObject(Data) = False Then Exit Sub
MsgBox Data.Rows.count
'copies data to new sheet
Selection.Copy
Sheets("Results").Select
ActiveSheet.paste