ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If...Then Insert (https://www.excelbanter.com/excel-programming/320027-re-if-then-insert.html)

Teresa

If...Then Insert
 
Thanks A Million Tom

"Tom Ogilvy" wrote:

There was/is a typo:

With Worksheets("Client Marketing")
* Worksheets("Jobs 0104").Cells(i, nCol).Copy Destination = .Cells(j,

1)
* j = j + 1
End With


Destination =
should be

Destination:=
with a colon then equal

--
Regards,
Tom Ogilvy

"teresa" wrote in message
...
Hi, this is working fine, but there's a couple of lines (asterisked) which
aren't processing fine.i.e. doesn't seem to be pasting. Thanks

Sub jo()
Dim i As Variant
nCol = 2
'FMNoCol = nCol + 6
j = 1
On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Client Marketing").Delete
Worksheets("No FM No").Delete
Application.DisplayAlerts = True
On Error GoTo 0
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name _
= "Client Marketing"
Worksheets.Add(After:=Worksheets(Worksheets.Count) ).Name _
= "No FM No"
j = 1
k = 1
LastRow = Worksheets("Jobs 0104") _
.Cells(Rows.Count, nCol).End(xlUp).Row
For i = 2 To LastRow
If Left(Worksheets("Jobs 0104").Cells(i, nCol), 6) = "CLIENT" _
Or Left(Worksheets("Jobs 0104").Cells(i, nCol), 3) = "CMJ" Then


With Worksheets("Client Marketing")
* Worksheets("Jobs 0104").Cells(i, nCol).Copy Destination = .Cells(j,

1)
* j = j + 1
End With


Else
If Worksheets("Jobs 0104").Cells(i, 8) = 0 Then
Worksheets("Jobs 0104").Cells(i, nCol).Copy
Destination = Worksheets("No FM No").Cells(k, 1)
k = k + 1
End If
End If

Next
End Sub









All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com