I would like to know how to write a copy loop in VBA based on what columns contain values.
Currently I have a submit button/macro for each column individually which copies one column from one sheet (Questionnaire) to another (Data). However I would like to submit all the columns where there is data in the columns.
How do I re-write this so that it copies column B then C and so on, if there is data in the column, then end? (Assuming when you reach a blank column are is no more columns to copy)
Sub SUMBIT()
'
Sheets("Data").Select
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Sheets("Questionnaire").Select
Columns("B:B").Select
Selection.Copy
Sheets("Data").Select
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("Questionaire").Select
Range("B1").Select
End Sub
Bookmarks