Copy data to another sheet depending on input of currency

ianharper68

New Member
Joined
May 16, 2024
Messages
43
Office Version
  1. 2021
Platform
  1. MacOS
So I have a main worksheet that stores all my invoices in 3 currencies (£, $ & €) However I need to also add the same data to 3 separate sheets based on each currency.

So can anyone let me know what the formula would be? I have a cell in column F that has a drop down list to choose the currency.

I know it should be simple but I just can't get it to work :(
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
First of all, change the sheet name "MASTER SHEET EURO" to "MASTER SHEET EUR" and then try this macro in the worksheet code module:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("G8", Range("G" & Rows.Count).End(xlUp))) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Dim ws As String, lRow As Long
    ws = "MASTER SHEET" & " " & Split(Target.Offset(, -1), " ")(0)
    With Sheets(ws)
        lRow = .Range("C7", .Range("C" & .Rows.Count).End(xlUp)).Find(What:="", lookat:=xlWhole).Row
        Range("C" & Target.Row).Resize(, 6).Copy .Range("C" & lRow)
    End With
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
First of all, change the sheet name "MASTER SHEET EURO" to "MASTER SHEET EUR" and then try this macro in the worksheet code module:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("G8", Range("G" & Rows.Count).End(xlUp))) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Dim ws As String, lRow As Long
    ws = "MASTER SHEET" & " " & Split(Target.Offset(, -1), " ")(0)
    With Sheets(ws)
        lRow = .Range("C7", .Range("C" & .Rows.Count).End(xlUp)).Find(What:="", lookat:=xlWhole).Row
        Range("C" & Target.Row).Resize(, 6).Copy .Range("C" & lRow)
    End With
    Application.ScreenUpdating = True
End Sub
Hi Mumps,

Thats works for the data from cells in columns C to G, however I need to the whole line to be copied over from B through AI

Also for some reason the first line of data on row 8 is copying over into both GBP and USD?
 
Upvote 0
This macro will copy to column AI.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("G8", Range("G" & Rows.Count).End(xlUp))) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Dim ws As String, lRow As Long
    ws = "MASTER SHEET" & " " & Split(Target.Offset(, -1), " ")(0)
    With Sheets(ws)
        lRow = .Range("C7", .Range("C" & .Rows.Count).End(xlUp)).Find(What:="", lookat:=xlWhole).Row
        Range("C" & Target.Row).Resize(, 33).Copy .Range("C" & lRow)
    End With
    Application.ScreenUpdating = True
End Sub
Also for some reason the first line of data on row 8 is copying over into both GBP and USD?
I could not reproduce this problem. The macro worked properly for me on the file you posted? Are you using the macro on a different file?
 
Upvote 0
This macro will copy to column AI.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.CountLarge > 1 Then Exit Sub
    If Intersect(Target, Range("G8", Range("G" & Rows.Count).End(xlUp))) Is Nothing Then Exit Sub
    Application.ScreenUpdating = False
    Dim ws As String, lRow As Long
    ws = "MASTER SHEET" & " " & Split(Target.Offset(, -1), " ")(0)
    With Sheets(ws)
        lRow = .Range("C7", .Range("C" & .Rows.Count).End(xlUp)).Find(What:="", lookat:=xlWhole).Row
        Range("C" & Target.Row).Resize(, 33).Copy .Range("C" & lRow)
    End With
    Application.ScreenUpdating = True
End Sub

I could not reproduce this problem. The macro worked properly for me on the file you posted? Are you using the macro on a different file?
Yeah funny because I can't get it to repeat either now?

I am only using the same test sheet I shared so I really do no know what I am doing wrong as the only data that copies over is the first 5 cells in columns C to G and not B to AL?
 
Upvote 0
I can't say why you are getting those results. For me, the macro is copying all the cells from C:AI as you requested.
 
Upvote 0
This is what I get when I enter value of 6789 in cell G8 of the MASTER SHEET. As you can see, it is copying all the data. However, it is also copying all the formulas from the MASTSER SHEET. This may give you unwanted results. You could copy the values only. Also have a look at the possible effects of any linked files.

NO SUPPLIER PO REFERENCE INVOICE NUMBER CURRENCY INVOICE VALUE EXA QtyHS CodesEX1COLLIE L WH CBM LDM NTW GRW Crate Pallet Carton Jiffy ADR PODCOCOur Collection Order Ref:Label NumberDate Goods InDate Goods outFree DaysChargeable DaysDomestic Collection ChargesFSC %Domestic Handling In ChargesDomestic Storage Charges
JBS Fabrication Ltd123456GBP £ 6,789.00 15 112010085 1.02 0.49 125.00 125.00 1 No PE0001/01115-11-24#REF!3#REF! 35.00 5.25 8.75 25.20
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,728
Members
452,939
Latest member
WCrawford

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