With or Select

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Right i i have one last thing for this which is that i need to delete some
ranges in a hidden sheet, but not sure how, my code doesn't like my range?
any help please


************************************************************
Sub PrintCode()
Dim i As Integer, c As Integer, Q As Integer
c = 0

For Q = 2 To 2
With Sheets("MacroData")
B = .Cells(Q, 2).Value
End With


For i = 1 To 10000
With Sheets("Salary etc")
A = Left(.Cells(i, 1), 3)
End With

If A = B Then
With Sheets("MacroData")
c = c + 1
.Cells(i, 5).Value = c

.Cells(i, 7).Value = 1


End With

End If
Next i
With Sheets("MacroData")
D = .Range("G2").Value
E = .Range("H2").Value
End With
Sheets("Salary etc").Select
Range(D & ":" & E).Select
Selection.PrintOut Copies:=1, Collate:=True

With Sheets("MacroData")
*****.Range("E5:E10000", "G5:G10000").Select*****
.Selection.ClearContents
End With

Next Q
End Sub

***********************************************************


THanks
Andy
 
This should work:

With Sheets("MacroData")
.Select
.Range("E5:E10000").ClearContents
.Range("G5:G10000").ClearContents
End With


-Jack
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top