jdub21

New Member
Joined
Sep 19, 2022
Messages
30
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
When I run my macro based on conditional formatting, it just adds to the bottom when i need it to post in A8. (I highlighted the cells in yellow to show the duplication)


New Vendors by State.xlsm
C
25
Onboarded
 
Try stepping through your code one line at a time, while watching what happens on your worksheets.
When you see what is happening, it often becomes obvious what the issue is.
See here for details on how to do this: Stepping Through a Macro with a Worksheet Visible in Excel
(note: Skip Step 3, as that will run your code in its entirety right away, when you actaully just want to step through it).

If you cannot figure it out, please provide us with a simple example that we can use, using XL2BB to post the data from the two sheets in question (just be sure to remove any sensitive data first).
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Here is the source sheet that I am pulling from ( all public info nothing private).... I changed to "CA" since it was formatted and had data pertaining to this process..



New Vendors by State.xlsm
ABCDEFGHIJKLM
1SourceSource CityZipCompanyDateNamePhoneCall ResultTrailerPricingInsurance?NotesSource
2YelpSan FernandoPrestige Junk Removal(747) 304-0385Not interested Robert said they are too busy to take on more work
3YelpSan FernandoOmar's Hauling(747) 259-0630Not interested Said they are not interested and hung up
4YelpSan FernandoTrash Kings Junk Removal and Haul Away(818) 850-8101Jon17.5cuy750/load 375/halfYesPossible flexibility but only close
5YelpSan FernandoSame Day Hauling & Junk Removal Services(562) 732-8946Contacted25ftQuote by job - 1000 to 2500 per load Hung up on me after giving price
6YelpSan FernandoSontero Junk Removal(818) 927-9486Contacted All he would say is to text a picture no problem. Trouble communicating
7YelpBurbankHauling LA Junk Removal Service(424) 328-5852Diane Israel is the owner and will not be in until tomorrow 8/24
8YelpBurbankCA Junk Hauler(818) 835-2475No call, price online 750/load per website
9YelpBurbankExpress Hauling & Junk Removal(424) 600-3678Contacted Hung up as soon as I introduced myself, followed up with a text on vonage
10YelpBurbankJPZ Haul Away(424) 360-4310No Answer Attempted to leave message but mailbox is full
11YelpBurbankOne Call Junk Haul San Fernando Valley(818) 873-0080already on textline 700 lowest price for a load
12YelpBurbankHonest Abe Junk Removal(818) 793-2531Not interested Said they are not interested and hung up
13CraigslistBurbankYobany(818) 200-8857LVM
CA
 
Upvote 0
This is the destination sheet. When you hit refresh, it runs the macro but nothing pastes.


New Vendors by State.xlsm
ABCDEFGHIJKLM
1
2
3
4
5
6
7SourceSource CityZipDatePOCCompanyPhoneCall ResultTrailer/Set upPricingInsurance?NotesSourcer
Onboarded



Here is the code for the macro


Sub CopyOnboarded()

Dim TransIDField As Range
Dim TransIDCell As Range
Dim ATransWS As Worksheet
Dim HTransWS As Worksheet

Set ATransWS = Worksheets("CA")
Set TransIDField = ATransWS.Range("A2", ATransWS.Range("A2").End(xlDown))
Set HTransWS = Worksheets("Onboarded")

' Find last row with data in column A on HTransWS sheet
lr = HTransWS.Cells(Rows.Count, "A").End(xlUp).Row

' Delete data from row 8 down
If lr >= 8 Then
HTransWS.Range("A8:A" & lr).EntireRow.Delete
End If

For Each TransIDCell In TransIDField

If TransIDCell.Interior.Color = RGB(198, 239, 206) Then

TransIDCell.Resize(1, 12).Copy Destination:= _
HTransWS.Range("A1").Offset(HTransWS.Rows.Count - 1, 0).End(xlUp).Offset(1, 0)

End If

Next TransIDCell

HTransWS.Columns.AutoFit

End Sub
 
Upvote 0
I have changed the RGB code to rgb(255, 199, 206) so it pulls the red and still nothing..... New code for the example sheets above



Sub CopyOnboarded()

Dim TransIDField As Range
Dim TransIDCell As Range
Dim ATransWS As Worksheet
Dim HTransWS As Worksheet

Set ATransWS = Worksheets("CA")
Set TransIDField = ATransWS.Range("A2", ATransWS.Range("A2").End(xlDown))
Set HTransWS = Worksheets("Onboarded")

' Find last row with data in column A on HTransWS sheet
lr = HTransWS.Cells(Rows.Count, "A").End(xlUp).Row

' Delete data from row 8 down
If lr >= 8 Then
HTransWS.Range("A8:A" & lr).EntireRow.Delete
End If

For Each TransIDCell In TransIDField

If TransIDCell.Interior.Color = RGB(255, 199, 206) Then

TransIDCell.Resize(1, 12).Copy Destination:= _
HTransWS.Range("A1").Offset(HTransWS.Rows.Count - 1, 0).End(xlUp).Offset(1, 0)

End If

Next TransIDCell

HTransWS.Columns.AutoFit

End Sub
 
Upvote 0
Joe - You are a genius and appreciate your patience with me. I made the most basic newb mistake that will haunt me for the rest of my days....... I forgot to hit save..... Everything is now working beautifully.
 
Upvote 0
Glad we got it all sorted!
 
Upvote 0
Joe - I keep running into timeout errors or excel just crashes...... I know that it is the fact that I have 50 sheets to run through...... Is there anything I can do to speed up the process. Right now I have duplicated the process 50 times to go and check each sheet which I know that there is an easier way. Please guide me obi wan.
 
Upvote 0
Joe - I keep running into timeout errors or excel just crashes...... I know that it is the fact that I have 50 sheets to run through...... Is there anything I can do to speed up the process. Right now I have duplicated the process 50 times to go and check each sheet which I know that there is an easier way. Please guide me obi wan.
I refer you back to the advice I gave back in post 9: Duplicate Cells
 
Upvote 0

Forum statistics

Threads
1,215,147
Messages
6,123,297
Members
449,095
Latest member
Chestertim

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top