Hi,
I'm trying to get a range from Sheet A based on some criteria and paste it to a newly added sheet with headings.
Wonder if someone can tell me what's wrong with the following: I'm not sure if there is such a thing as SourceSheet.
Any help is greatly appreciated!!!
Thanks much!!!!
Suki
Dim myNum As String
Dim SourceSheet As Worksheet
Dim x As Integer
Dim iRow As Long
Range("Z800").S elect
myNum = Application.Inp utBox("Enter check deposit date eg dd/mm/yy")
ActiveCell.Form ulaR1C1 = myNum
Range("C2:C1000 ").Select
Cells.Find(What :=myNum, After:=ActiveCe ll, LookIn:=xlValue s, LookAt _
:=xlPart, SearchOrder:=xl ByColumns, SearchDirection :=xlNext, MatchCase:= _
False).Activate
Range(Cells(iRo w, 2), _
Cells(1000, 5)).Copy
Range("B1001"). Select
ActiveSheet.Pas te
Set SourceSheet = ActiveSheet
Application.Wor ksheets.Add
'Populate the heading description
Range("A1") = "Check Reference"
Range("B1") = "Check Amount"
Range("A2") = "Example"
Range("A2").Cop y
Range("B2").Pas teSpecial
Cells(1, 1).Select
ActiveCell.End( xlDown).Select
iRow = ActiveCell.Row + 1
For x = 1001 To 2000
If .Range("B" & x) <> "GIRO" And .Range("B" & x) <> "" Then
.Range("A" & iRow) = .Range("B" & x) 'check #
.Range("B" & iRow) = .Range("E" & x) 'Ck Amt
End If
iRow = iRow + 1
Next
I'm trying to get a range from Sheet A based on some criteria and paste it to a newly added sheet with headings.
Wonder if someone can tell me what's wrong with the following: I'm not sure if there is such a thing as SourceSheet.
Any help is greatly appreciated!!!
Thanks much!!!!
Suki
Dim myNum As String
Dim SourceSheet As Worksheet
Dim x As Integer
Dim iRow As Long
Range("Z800").S elect
myNum = Application.Inp utBox("Enter check deposit date eg dd/mm/yy")
ActiveCell.Form ulaR1C1 = myNum
Range("C2:C1000 ").Select
Cells.Find(What :=myNum, After:=ActiveCe ll, LookIn:=xlValue s, LookAt _
:=xlPart, SearchOrder:=xl ByColumns, SearchDirection :=xlNext, MatchCase:= _
False).Activate
Range(Cells(iRo w, 2), _
Cells(1000, 5)).Copy
Range("B1001"). Select
ActiveSheet.Pas te
Set SourceSheet = ActiveSheet
Application.Wor ksheets.Add
'Populate the heading description
Range("A1") = "Check Reference"
Range("B1") = "Check Amount"
Range("A2") = "Example"
Range("A2").Cop y
Range("B2").Pas teSpecial
Cells(1, 1).Select
ActiveCell.End( xlDown).Select
iRow = ActiveCell.Row + 1
For x = 1001 To 2000
If .Range("B" & x) <> "GIRO" And .Range("B" & x) <> "" Then
.Range("A" & iRow) = .Range("B" & x) 'check #
.Range("B" & iRow) = .Range("E" & x) 'Ck Amt
End If
iRow = iRow + 1
Next