Conditional cross-sheet copying

bjorncl

New Member
Joined
Apr 13, 2015
Messages
1
Dearest pros ,

I'm having trouble with finding out how to do this in the manner i want it to work. I found some solutions of premade code that almost did the job but i can't seem to get the right code.

WHAT I'M TRYING TO DO:

-> We got an excel file with 2 different tabs. (clients and offers)
-> In the clients sheet i have differten colums (col B - col J)
-> IF colum H = "Offer ready" THEN copy (same row) col B,C,D,E,F,H,I (so every column except G and J) to worksheet "offers"
-> It should be placed at the bottom of the page, seeing as this will be a table containing all offers

As i stated before, i found a solution to copy the entire row, but i'm too inexperienced in excel VBA to actually analyze the code.

Can someone please help me with this ? I'm trying to streamline our workflow in the office and this would be a great help!

Thank you in advance all :) I'm sure some of you will have the answer ready for typing.

Greetings from Belgium,
Bjorn
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi Bjorn. Try:
Code:
Sub CopyRange()
    Application.ScreenUpdating = False
    Dim LastRow As Long
    LastRow = Sheets("clients").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Dim rng As Range
    For Each rng In Sheets("clients").Range("H2:H" & LastRow)
        If rng = "Offers ready" Then
            Sheets("clients").Range("B" & rng.Row & ":F" & rng.Row).Copy Sheets("offers").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
            Sheets("clients").Range("H" & rng.Row & ":I" & rng.Row).Copy Sheets("offers").Cells(Rows.Count, "F").End(xlUp).Offset(1, 0)
        End If
    Next rng
    Application.ScreenUpdating = True
End Sub
Since you didn't mention where on sheet "offers" you wanted the data copied, the macro starts to copy to column A.
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,360
Members
449,155
Latest member
ravioli44

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