F
Frank
In the macro below, I am attempting to test the value of the contents
of an Column (F). Based on that value, the macro should copy the row
contents to a new workbook. I suspect I am attempting to use the
wrong command as I am a newbie.
Compile error is: Statement invalid outside Type block
Sub UPDATE_STATUS()
' Purpose of this section is to delete old data from resultant
worksheets
Sheets("Personal").Select
Rows("2:65535").Select
Selection.Delete Shift:=xlUp
Sheets("Corporate").Select
Rows("2:65535").Select
Selection.Delete Shift:=xlUp
Sheets("Disconnect").Select
Rows("2:65535").Select
Selection.Delete Shift:=xlUp
' Purpose of this section is copying of data to appropriate resultant
worksheets
Sheets("Master").Select
Range("F:F") As Range
If Value = "P" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Personal").Cells(Rows.Count, 1).End(xlUp)(2)
End If
If Value = "C" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Corporate").Cells(Rows.Count, 1).End(xlUp)(2)
End If
If Value = "D" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Disconnect").Cells(Rows.Count, 1).End(xlUp)
(2)
End If
ActiveWorkbook.Save
End Sub
of an Column (F). Based on that value, the macro should copy the row
contents to a new workbook. I suspect I am attempting to use the
wrong command as I am a newbie.
Compile error is: Statement invalid outside Type block
Sub UPDATE_STATUS()
' Purpose of this section is to delete old data from resultant
worksheets
Sheets("Personal").Select
Rows("2:65535").Select
Selection.Delete Shift:=xlUp
Sheets("Corporate").Select
Rows("2:65535").Select
Selection.Delete Shift:=xlUp
Sheets("Disconnect").Select
Rows("2:65535").Select
Selection.Delete Shift:=xlUp
' Purpose of this section is copying of data to appropriate resultant
worksheets
Sheets("Master").Select
Range("F:F") As Range
If Value = "P" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Personal").Cells(Rows.Count, 1).End(xlUp)(2)
End If
If Value = "C" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Corporate").Cells(Rows.Count, 1).End(xlUp)(2)
End If
If Value = "D" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Disconnect").Cells(Rows.Count, 1).End(xlUp)
(2)
End If
ActiveWorkbook.Save
End Sub