I have three sheets, sheet S, Sheet P and Sheet Data.
I first copy the column of Sheet S to Sheet Data. Then in column E of sheet Data, I look for the ID. The ID In column E of data sheet, matches with the column A of P sheet, then I copy the corresponding ID.
The problem here is the Sheet data contains 214 rows, while sheet P contains 1110.
while comparing the ID, there are two different ID from row 870 and 871, which are not copied, even though they are same.
Could someone guide what could be the reason ?
Sub lookup()
Dim lLastrow, totalrows As Long
Dim rng As Range
Dim i As Long
'Copy lookup values from S to Data
With Sheets("S")
lLastrow = .Cells(.Rows.count, 1).End(xlUp).Row
.Range("P5:P" & lLastrow).Copy Destination:=Sheets("Data").Range("E5")
.Range("G5:G" & lLastrow).Copy Destination:=Sheets("Data").Range("H5")
End With
totalrows = Sheets("P").Cells(Sheets("P").Rows.count, "A").End(xlUp).Row
For i = 5 To lLastrow
'Search for the value on P_APQP
With Sheets("P")
Set rng = .Columns(1).Find(Sheets("Data").Cells(i, 5).Value & "*", lookat:=xlWhole)
End With
'If it is found put its value on the destination sheet
If Not rng Is Nothing Then
With Sheets("Data")
.Cells(i, 6).Value = rng.Value
.Cells(i, 1).Value = rng.Offset(0, 1).Value
.Cells(i, 2).Value = rng.Offset(0, 2).Value
.Cells(i, 3).Value = rng.Offset(0, 3).Value
.Cells(i, 4).Value = rng.Offset(0, 9).Value
.Cells(i, 9).Value = rng.Offset(0, 10).Value
.Cells(i, 13).Value = rng.Offset(0, 6).Value
.Cells(i, 14).Value = rng.Offset(0, 5).Value
.Cells(i, 15).Value = rng.Offset(0, 4).Value
.Cells(i, 16).Value = rng.Offset(0, 8).Value
End With
End If
Next i
End Sub
I'll post the whole code. I also made an adjustment to your first line of declarations - as you had it, only totalrows was being declared as Long. You have to spell each one out I'm afraid.
Sub lookup()
Dim lLastrow As Long, totalrows As Long
Dim rng As Range
Dim i As Long
With Sheets("S")
lLastrow = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("P5:P" & lLastrow).Copy Destination:=Sheets("Data").Range("E5")
.Range("G5:G" & lLastrow).Copy Destination:=Sheets("Data").Range("H5")
End With
totalrows = Sheets("P").Cells(Sheets("P").Rows.Count, "A").End(xlUp).Row
For i = 5 To lLastrow
'Search for the value on P_APQP
With Sheets("P")
'amended below
Set rng = .Columns(1).Find(Trim(Sheets("Data").Cells(i, 5).Value) & "*", lookat:=xlWhole)
End With
'If it is found put its value on the destination sheet
If Not rng Is Nothing Then
With Sheets("Data")
.Cells(i, 6).Value = rng.Value
.Cells(i, 1).Resize(, 3).Value = rng.Offset(0, 1).Value
.Cells(i, 2).Value = rng.Offset(0, 2).Value
.Cells(i, 3).Value = rng.Offset(0, 3).Value
.Cells(i, 4).Value = rng.Offset(0, 9).Value
.Cells(i, 9).Value = rng.Offset(0, 10).Value
.Cells(i, 13).Value = rng.Offset(0, 6).Value
.Cells(i, 14).Value = rng.Offset(0, 5).Value
.Cells(i, 15).Value = rng.Offset(0, 4).Value
.Cells(i, 16).Value = rng.Offset(0, 8).Value
End With
End If
Next i
End Sub
Related
I have three sheet, Sheet1 , sheet2, and sheet3.
Sheet3 is my result sheet.
I have the ID in column E of sheet3, copied from Column P of sheet1. I compare the ID of sheet3, with ID of sheet2. I am successful.
but, i have an issue while comparing. The ID are generally 11 to 13 Digit Long.
Case1, in few cases i have id in sheet 3 as D2C12682300 and in sheet2 the same ID as D2C1268230000, in this case, i want them to be matched, but according to my code, it is not getting matched.
Case2, in somecase i have the id in sheet3 as D2C12682300_id4576901 and in the sheet2 i have the same id as D2C1268230000. I want them to be matched, but my code is not working this way.
Could someone suggest, how i could include These condition in my code.I am struck how to do it.
Below is the code, i am using to look for id from sheet3 to sheet2. I want to include These cases in this code.
Sub lookup()
Dim lLastRow As Long
Dim rng As Range
Dim i As Long
'Copy lookup values from sheet1 to sheet3
ThisWorkbook.Sheets("S").Select
lLastRow = ActiveSheet.Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
Range("P5:P" & lLastRow).Copy Destination:=Sheets("Result").Range("E5")
Range("G5:G" & lLastRow).Copy Destination:=Sheets("Result").Range("H5")
'Go to the destination sheet
Sheets("Result_").Select
For i = 5 To lLastRow
'Search for the value on sheet2
Set rng = Sheets("P").UsedRange.Find(Cells(i, 5).Value)
'If it is found put its value on the destination sheet
If Not rng Is Nothing Then
Cells(i, 6).Value = rng.Value
Cells(i, 1).Value = rng.Offset(0, 1).Value
Cells(i, 2).Value = rng.Offset(0, 2).Value
Cells(i, 3).Value = rng.Offset(0, 3).Value
Cells(i, 4).Value = rng.Offset(0, 9).Value
Cells(i, 9).Value = rng.Offset(0, 10).Value
Cells(i, 12).Value = rng.Offset(0, 6).Value
Cells(i, 13).Value = rng.Offset(0, 5).Value
Cells(i, 14).Value = rng.Offset(0, 8).Value
End If
Next i
End Sub
Use a Wildcard:
Set rng = Sheets("P").UsedRange.Find(Cells(i, 5).Value & "*", LookAt:=xlWhole)
Also avoid using .Select and objectify .Range, .Cells etc. Read How to Avoid Select.
I am having 4 sht, sht1, sht2, sht3 and sht4.
I am copying the columns E and F from sht 1 to sht3. and then i look into the corresponding values in sht 2, and paste them in sht3.
I then lookinto in my sht3, if the column "G" has "NO"; then i copy the corresponding rows to sht4.
till, this i have completed coding.
I wanted to look into the column E in sht4, and paste the corresponding ID from sht1. Could someone tell, how i could do it ?
EDIT.
In sht3, i have the rows filled only when there is Id in column F.
In few cases, i dont have column F,means there is no ID.
so, i copy them to sht4. Now i have in sht4, column E Filled. I want to look into the relevant Information of those ID in sht1. I want the Information from each and every column in sht1, except E .
I know we can use Offset, but how do I use it in this case,
I have tried the following code
Sub nlookup()
Dim i As Long
Dim totalrows As Long
Dim rng As Range
Sheets("sht1").Select
totalrows = ActiveSheet.UsedRange.Rows.Count
Sheets("sht4").Select
For i = 5 To totalrows
Set rng = Sheets("sht2").UsedRange.Find(Cells(i, 5).Value)
'If it is found put its value on the destination sheet
If Not rng Is Nothing Then
Cells(i, 6).Value = rng.Value
Cells(i, 1).Value = rng.Offset(0, 0).Value
Cells(i, 2).Value = rng.Offset(0, 14).Value
Cells(i, 3).Value = rng.Offset(0, 1).Value
Cells(i, 4).Value = rng.Offset(0, 2).Value
Cells(i, 12).Value = rng.Offset(0, 8).Value
Cells(i, 13).Value = rng.Offset(0, 9).Value
End If
Next
End Sub
Set rng = Sheets("sht2").UsedRange.Find(Cells(i, 5).Value), there is no Need of looking into this line, i beleive.
The code will consider the following as discussed in chat:
Data should be copied from sht1 to sht4 on Id's in both sheets
Id's are in Column L and Column E for sht1 and sht4 respectively
Columns to be copy from sht1 to sht4 as A->A, B->C,C->D,I->L,J->M,O->B
Data in sht1 and sht4 starts from Row 5 and Row 2 respectively
Sub Demo()
Dim srcLastRow As Long, destLastRow As Long
Dim srcWS As Worksheet, destWS As Worksheet
Dim i As Long, j As Long
Application.ScreenUpdating = False
Set srcWS = ThisWorkbook.Sheets("Sht1")
Set destWS = ThisWorkbook.Sheets("Sht4")
srcLastRow = srcWS.Cells(srcWS.Rows.Count, "L").End(xlUp).Row
destLastRow = destWS.Cells(destWS.Rows.Count, "E").End(xlUp).Row
For i = 2 To destLastRow
For j = 5 To srcLastRow
If destWS.Cells(i, "E").Value = srcWS.Cells(j, "L").Value Then
destWS.Cells(i, "A") = srcWS.Cells(j, "A")
destWS.Cells(i, "B") = srcWS.Cells(j, "O")
destWS.Cells(i, "C") = srcWS.Cells(j, "B")
destWS.Cells(i, "D") = srcWS.Cells(j, "C")
destWS.Cells(i, "L") = srcWS.Cells(j, "I")
destWS.Cells(i, "M") = srcWS.Cells(j, "J")
End If
Next j
Next i
Application.ScreenUpdating = True
End Sub
Why not just use Cells(i, 4).Value = rng.Cells(i, 6).Value ?
Also get rid of the.Select
Sub nlookup()
dim sht as Worksheet
Dim i As Long
Dim totalrows As Long
Dim rng As Range
totalrows = Sheets("sht1").UsedRange.Rows.Count
Set sht = Worksheets("sht4")
For i = 5 To totalrows
Set rng = Sheets("sht2").UsedRange.Find(sht.Cells(i, 5).Value)
'If it is found put its value on the destination sheet
If Not rng Is Nothing Then
sht.Cells(i, 6).Value = rng.Value
sht.Cells(i, 1).Value = rng.Cells(i, 1).Value
sht.Cells(i, 2).Value = rng.Cells(i, 16).Value
sht.Cells(i, 3).Value = rng.Cells(i, 4).Value
sht.Cells(i, 4).Value = rng.Cells(i, 6).Value
sht.Cells(i, 12).Value = rng.Cells(i, 20).Value
sht.Cells(i, 13).Value = rng.Cells(i, 22).Value
End If
Next
End Sub
I wanted to reach out on a concern i am getting with with my loop. i need to copy all trainee data in the class list sheet from rows 13 on and put it into a roster registry sheet same workbook. however the code i wrote initially is giving me and error when i use .Range(i, 1) so i changed it to .Cells. Main concern is that the code writes the data into the roster registry sheet but only the last trainee data.
Option Explicit
Sub ExportcReg()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim wbk1 As Workbook
Dim s1, cReg As Worksheet
Dim x, i, FinalRow As Long
Dim thisvalue As String
Set wbk1 = Workbooks.Open(ThisWorkbook.Worksheets("Info").Range("A1").Value)
Set s1 = wbk1.Sheets("ClassRegistry")
Set cReg = ThisWorkbook.Worksheets("Class Registry")
With cReg
' Find the last row of data in Column "A"
FinalRow = .Cells(.Rows.Count, "A").End(xlUp).Row
' Loop through each row
For x = 2 To FinalRow
' Decide if to copy based on column A
thisvalue = .Cells(x, 1).Value
If thisvalue <> "" Then
i = s1.Cells(s1.Rows.Count, 1).End(xlUp).Row + 1
s1.Cells(i, 1).Value = thisvalue
s1.Cells(i, 2).Value = .Cells(x, 2).Value
s1.Cells(i, 3).Value = .Cells(x, 3).Value
s1.Cells(i, 4).Value = .Cells(x, 4).Value
s1.Cells(i, 5).Value = .Cells(x, 5).Value
s1.Cells(i, 6).Value = .Cells(x, 5).Value
s1.Cells(i, 7).Value = .Cells(x, 7).Value
s1.Cells(i, 8).Value = .Cells(x, 8).Value
s1.Cells(i, 9).Value = .Cells(x, 9).Value
s1.Cells(i, 10).Value = .Cells(x, 10).Value
s1.Cells(i, 11).Value = .Cells(x, 11).Value
s1.Cells(i, 12).Value = .Cells(x, 12).Value
s1.Cells(i, 13).Value = .Cells(x, 13).Value
s1.Cells(i, 14).Value = .Cells(x, 14).Value
s1.Cells(i, 15).Value = .Cells(x, 15).Value
s1.Cells(i, 16).Value = .Cells(x, 16).Value
s1.Cells(i, 17).Value = .Cells(x, 17).Value
s1.Cells(i, 18).Value = .Cells(x, 18).Value
End If
Next x
End With
wbk1.Close savechanges:=True
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
You have too much logical and technical errors in your code which I cannot explain line by line. Besides you can achieve your goal with less coding. Maybe what you need is a working code to understand how things work. Take a look at this:
Sub CListtoRReg()
'From Class List to Roster Registry
Dim ws1 As Worksheet: Set ws1 = Worksheets("Class List")
Dim ws2 As Worksheet: Set ws2 = Worksheets("Roster Registry")
Dim i, j As Long
For i = 13 To ws1.Cells(1, 1).End(xlDown).Row
ws2.Cells(1, 1).End(xlDown).Offset(1) = ws1.Range("C2").Value
For j = 2 To 11
ws2.Cells(1, 1).End(xlDown).Offset(0, j - 1) = ws1.Cells(i, j - 1).Value
Next j
Next i
End Sub
I have create 2 sub function like this:
Sub Product1()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Inventory")
lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
If IsEmpty(UserForm5.ComboBox5.Value) Then
Exit Sub
Else
.Cells(lRow, 1).Value = UserForm5.TextBox1.Value
.Cells(lRow, 2).Value = UserForm5.ComboBox2.Value
.Cells(lRow, 3).Value = UserForm5.ComboBox3.Value
.Cells(lRow, 4).Value = UserForm5.ComboBox4.Value
.Cells(lRow, 5).Value = UserForm5.ComboBox1.Value
.Cells(lRow, 6).Value = UserForm5.ComboBox5.Value
.Cells(lRow, 7).Value = UserForm5.TextBox2.Value
.Cells(lRow, 8).Value = UserForm5.TextBox5.Value
.Cells(lRow, 9).Value = UserForm5.TextBox6.Value
.Cells(lRow, 10).Value = UserForm5.TextBox4.Value
.Cells(lRow, 11).Value = UserForm5.TextBox7.Value
End If
End With
End Sub
Sub Product2()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Inventory")
lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
If IsEmpty(UserForm5.ComboBox6.Value) Then
Exit Sub
Else
.Cells(lRow, 1).Value = UserForm5.TextBox1.Value
.Cells(lRow, 2).Value = UserForm5.ComboBox2.Value
.Cells(lRow, 3).Value = UserForm5.ComboBox3.Value
.Cells(lRow, 4).Value = UserForm5.ComboBox4.Value
.Cells(lRow, 5).Value = UserForm5.ComboBox1.Value
.Cells(lRow, 6).Value = UserForm5.ComboBox6.Value
.Cells(lRow, 7).Value = UserForm5.TextBox9.Value
.Cells(lRow, 8).Value = UserForm5.TextBox11.Value
.Cells(lRow, 9).Value = UserForm5.TextBox12.Value
.Cells(lRow, 10).Value = UserForm5.TextBox10.Value
.Cells(lRow, 11).Value = UserForm5.TextBox8.Value
End If
End With
End Sub
I was wondering that, if my combobox6 is empty, it should not transfer the data for to exel sheet.
What I faced now is if the combobox6 is empty( did not select any value), it will still copy all the data to the excel sheet.
Is there any way to fix it?
Change
If IsEmpty(UserForm5.ComboBox5.Value) Then
to
If UserForm5.ComboBox5.Value = "" Then
And make the same sort of change to the Product2 sub.
If the combo box is "empty" then checking its value will give you an empty string.
Sub Product1()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Inventory")
lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
If UserForm5.ComboBox5.Value <> "" Then
Exit Sub
Else
.Cells(lRow, 1).Value = UserForm5.TextBox1.Value
.Cells(lRow, 2).Value = UserForm5.ComboBox2.Value
.Cells(lRow, 3).Value = UserForm5.ComboBox3.Value
.Cells(lRow, 4).Value = UserForm5.ComboBox4.Value
.Cells(lRow, 5).Value = UserForm5.ComboBox1.Value
.Cells(lRow, 6).Value = UserForm5.ComboBox5.Value
.Cells(lRow, 7).Value = UserForm5.TextBox2.Value
.Cells(lRow, 8).Value = UserForm5.TextBox5.Value
.Cells(lRow, 9).Value = UserForm5.TextBox6.Value
.Cells(lRow, 10).Value = UserForm5.TextBox4.Value
.Cells(lRow, 11).Value = UserForm5.TextBox7.Value
End If
End With
End Sub
Sub Product2()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Inventory")
lRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
If UserForm5.ComboBox6.Value <> "" Then
Exit Sub
Else
.Cells(lRow, 1).Value = UserForm5.TextBox1.Value
.Cells(lRow, 2).Value = UserForm5.ComboBox2.Value
.Cells(lRow, 3).Value = UserForm5.ComboBox3.Value
.Cells(lRow, 4).Value = UserForm5.ComboBox4.Value
.Cells(lRow, 5).Value = UserForm5.ComboBox1.Value
.Cells(lRow, 6).Value = UserForm5.ComboBox6.Value
.Cells(lRow, 7).Value = UserForm5.TextBox9.Value
.Cells(lRow, 8).Value = UserForm5.TextBox11.Value
.Cells(lRow, 9).Value = UserForm5.TextBox12.Value
.Cells(lRow, 10).Value = UserForm5.TextBox10.Value
.Cells(lRow, 11).Value = UserForm5.TextBox8.Value
End If
End With
End Sub
I am attempting to do the following:
Look at the first row's column B (Event) from entiresalespipeline
Match Column B to a table (Events_and_Activities) that links a date to each event
If that date is in the future, copy the entire row into the next empty row in a third worksheet (CurrentSalesPipeline)
Repeat this process until there are no more filled rows in the first spreadsheet.
I have created the following code, which when I mouse-over the text appears to give correct data, but which gives me the following error:
Run-time error '13': Type mismatch
Sub ShowUpcoming_Click()
Dim rCell As Range
Dim ws As Worksheet
Dim DateConf As Long
For Each rCell In Sheet1.Range("B3:B5000")
Set ws = Worksheets("CurrentSalesPipeline")
DateConf = Application.VLookup(rCell, Worksheets("Events_and_Activities").Range("A2:B12"), 2, False)
Range("A1").Value = DateConf
If CDate(DateConf) >= CDate((Date)) Then
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
.Cells(iRow, 1).Value = Worksheets("entiresalespipeline").Range("A3:A3").Value
.Cells(iRow, 2).Value = Worksheets("entiresalespipeline").Range("B3:B3").Value
.Cells(iRow, 3).Value = Worksheets("entiresalespipeline").Range("C3:C3").Value
.Cells(iRow, 4).Value = Worksheets("entiresalespipeline").Range("D3:D3").Value
.Cells(iRow, 5).Value = Worksheets("entiresalespipeline").Range("E3:E3").Value
.Cells(iRow, 6).Value = Worksheets("entiresalespipeline").Range("F3:F3").Value
.Cells(iRow, 7).Value = Worksheets("entiresalespipeline").Range("G3:G3").Value
.Cells(iRow, 8).Value = Worksheets("entiresalespipeline").Range("H3:H3").Value
.Cells(iRow, 9).Value = Worksheets("entiresalespipeline").Range("I3:I3").Value
.Cells(iRow, 10).Value = Worksheets("entiresalespipeline").Range("J3:J3").Value
.Cells(iRow, 11).Value = Worksheets("entiresalespipeline").Range("K3:K3").Value
.Cells(iRow, 12).Value = Worksheets("entiresalespipeline").Range("L3:L3").Value
.Cells(iRow, 13).Value = Worksheets("entiresalespipeline").Range("M3:M3").Value
.Cells(iRow, 14).Value = Worksheets("entiresalespipeline").Range("N3:N3").Value
.Cells(iRow, 15).Value = Worksheets("entiresalespipeline").Range("O3:O3").Value
.Cells(iRow, 16).Value = Worksheets("entiresalespipeline").Range("P3:P3").Value
.Cells(iRow, 17).Value = Worksheets("entiresalespipeline").Range("Q3:Q3").Value
.Cells(iRow, 18).Value = Worksheets("entiresalespipeline").Range("R3:R3").Value
.Cells(iRow, 19).Value = Worksheets("entiresalespipeline").Range("S3:S3").Value
.Cells(iRow, 20).Value = Worksheets("entiresalespipeline").Range("T3:T3").Value
End With
End If
Next rCell
End Sub
You're declaring DateConf as a Long:
Dim DateConf As Long
And then assigning it the result of the VLookup call:
DateConf = Application.VLookup(rCell, Worksheets("Events_and_Activities").Range("A2:B12"), 2, False)
That's a lot of assumptions to make: you're relying on VBA to perform an implicit conversion of the returned value to a Long, without knowing if the returned value will be a valid numeric.
What if the VLookup returns an empty string? What if it returned an #N/A error value?
Dim lookupResult As Variant
lookupResult = Application.VLookup(rCell, Worksheets("Events_and_Activities").Range("A2:B12"), 2, False)
If IsNumeric(lookupResult) Then
DateConf = CLng(lookupResult)
...
End If
Reduce the number of assumptions you're making, you'll reduce the number of potential issues by as much.
Thank you everyone for your very thoughtful and extremely helpful input!
After some tinkering, I managed to come up with the following, which does everything I need it to do.
Mat's Mug - your suggestion was perfect!
Tim Williams - I tried your single line solution to the copy/pasting, but it only copied the first line (headings) over every line in the range, so I stuck with what I had.
Sub ShowUpcoming_Click()
Dim lastrow As Long
Dim ws As Worksheet
Dim DateConf As Long
Dim r As Long
Set ws = Worksheets("CurrentSalesPipeline")
Dim lookupresult As Variant
'find last completed row of entire spreadsheet
lastrow = Worksheets("EntireSalesPipeline").Range("B" & Rows.Count).End(xlUp).Row
'From the first completed line (row 3) to last completed row
For r = 3 To lastrow
'lookup conference date from events/activities spreadsheet
lookupresult = Application.VLookup(Worksheets("EntireSalesPipeline").Cells(r, 2).Value, Worksheets("Events_and_activities").Range("A2:B13"), 2, False)
If IsNumeric(lookupresult) Then
DateConf = CLng(lookupresult)
End If
'If vlookup finds a date, then check to make sure it is in the future from when the button was hit.
If CDate(DateConf) >= CDate((Date)) Then
'If it is a future event, then copy that data into the current spreadsheet
iRow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _
SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1
With ws
.Cells(iRow, 1).Value = Worksheets("entiresalespipeline").Cells(r, 1).Value
.Cells(iRow, 2).Value = Worksheets("entiresalespipeline").Cells(r, 2).Value
.Cells(iRow, 3).Value = Worksheets("entiresalespipeline").Cells(r, 3).Value
.Cells(iRow, 4).Value = Worksheets("entiresalespipeline").Cells(r, 4).Value
.Cells(iRow, 5).Value = Worksheets("entiresalespipeline").Cells(r, 5).Value
.Cells(iRow, 6).Value = Worksheets("entiresalespipeline").Cells(r, 6).Value
.Cells(iRow, 7).Value = Worksheets("entiresalespipeline").Cells(r, 7).Value
.Cells(iRow, 8).Value = Worksheets("entiresalespipeline").Cells(r, 8).Value
.Cells(iRow, 9).Value = Worksheets("entiresalespipeline").Cells(r, 9).Value
.Cells(iRow, 10).Value = Worksheets("entiresalespipeline").Cells(r, 10).Value
.Cells(iRow, 11).Value = Worksheets("entiresalespipeline").Cells(r, 11).Value
.Cells(iRow, 12).Value = Worksheets("entiresalespipeline").Cells(r, 12).Value
.Cells(iRow, 13).Value = Worksheets("entiresalespipeline").Cells(r, 13).Value
.Cells(iRow, 14).Value = Worksheets("entiresalespipeline").Cells(r, 14).Value
.Cells(iRow, 15).Value = Worksheets("entiresalespipeline").Cells(r, 15).Value
.Cells(iRow, 16).Value = Worksheets("entiresalespipeline").Cells(r, 16).Value
.Cells(iRow, 17).Value = Worksheets("entiresalespipeline").Cells(r, 17).Value
.Cells(iRow, 18).Value = Worksheets("entiresalespipeline").Cells(r, 18).Value
.Cells(iRow, 19).Value = Worksheets("entiresalespipeline").Cells(r, 19).Value
.Cells(iRow, 20).Value = Worksheets("entiresalespipeline").Cells(r, 20).Value
End With
End If
'Repeat for next line in existing
Next r
End Sub
This is a great community. Thank you again!
Sarah