View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Frank[_27_] Frank[_27_] is offline
external usenet poster
 
Posts: 8
Default Simple Macro problem. How do I test the entire range

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.Cou nt, 1).End(xlUp)(2)
End If

If Value = "C" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Corporate").Cells(Rows.Co unt, 1).End(xlUp)(2)
End If

If Value = "D" Then
Cells(Row, 1).Resize(1, 29).Copy
Destination:=Worksheets("Disconnect").Cells(Rows.C ount, 1).End(xlUp)
(2)
End If

ActiveWorkbook.Save





End Sub