Originally, I wanted to copy / paste some data from one sheet to another, so I created the below macro to do so. I have macros to call out each specific row in order to keep the code simple (or so I thought). I then created another macro to "export" the data by using the application.run command for all the macros. However, when I don't have data in a row, the fill.down command on the paste sheet still wants to execute. I know there's probably a way to incorporate an IF Blank statement. Or should I have just used a loop to begin with? I was trying to steer away from them because I don't understand the code and how it works. Below are my current macros
This macro is is duplicated for each specific row
Then I use this to "export" the data.
This macro is is duplicated for each specific row
VBA Code:
Sub Row_11()
'
'Row_11 Macro
'
'Copy and transpose treatment data
Range("F9:I9,F11:I11").Select
Range("F11").Activate
Selection.Copy
Sheets("Billing Form").Select
Range("D" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
Application.CutCopyMode = False
'Then copy and paste Location & Wellmaster based on # of transposed cells above
Sheets("GEP 1").Select
Range("A11,C11:D11").Select
Selection.Copy
Sheets("Billing Form").Select
Range("A" & Rows.Count).End(xlUp).Offset(1).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Dim LastRow As Long
LastRow = Cells(Cells.Rows.Count, "D").End(xlUp).Row
If Range("A10") = "" Then
Range("A9:C" & LastRow).FillDown
Sheets("GEP 1").Select
Else
Range(Cells(Rows.Count, 1).End(xlUp), "C" & LastRow).FillDown
Sheets("GEP 1").Select
End If
End Sub
Then I use this to "export" the data.
VBA Code:
Sub Export_GEP_1()
'
' Export Macro
'
'
Application.Run "Module3.Row_10"
Application.Run "Module3.Row_11"
Application.Run "Module3.Row_12"
Application.Run "Module3.Row_13"
Application.Run "Module3.Row_14"
Application.Run "Module3.Row_15"
Application.Run "Module3.Row_16"
Application.Run "Module3.Row_17"
Application.Run "Module3.Row_18"
Application.Run "Module3.Row_19"
Application.Run "Module3.Row_20"
Application.Run "Module3.Row_21"
Application.Run "Module3.Row_22"
Application.Run "Module3.Row_23"
Application.Run "Module3.Row_24"
End Sub