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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
It would be real helpful if you posted a sample of your data using XL2BB in order to maintain formatting. Your sample should be representative of your actual data and should contain 8-12 records.
 
Upvote 0
Here is just a small part, this sheet is called "Master" so where the Currency is I would want the line of data per currency copying automatically to the appropriate currency sheet i.e GBP Invoices, USD Invoices, EUR Invoices

PE0001 - EDCR Master Worksheet copy.xlsx
ABCDEFG
1
2CONSOL: PE0001
3
5
6
7NO SUPPLIER PO REFERENCE INVOICE NUMBER CURRENCY INVOICE VALUE
81AMOTN23-0876A2957GBP £3,467.80
92DCL WarehousingN23-045632567USD $24,789.50
103MacLean ElectricalN24-0367Inv09856GBP £12,967.34
114LHR Marine LtdEDCR-M24-5058I-87234EUR €18,957.00
125NOV Rig TechnologiesEDCR-M24-5006_225-0986USD $1,356.79
136NOV Rig TechnologiesM24-050825-0879USD $123,489.00
147Craig International LtdM24-500Inv250986GBP £4,789.00
158MB Air Systems LtdN24-044821367GBP £2,378.90
169
1710
1811
1912
MASTER SHEET
Cell Formulas
RangeFormula
D2D2=Dashboard!U3
B8:B19B8=ROW()-7
Cells with Data Validation
CellAllowCriteria
C8:C19List=Lists!$F$21:$F$67
F8:F15List=Lists!$J$4:$J$7
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your MASTER SHEET sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. This macro is triggered by a change in column G. When you enter a value in column G and press the ENTER key, the data in that row will be automatically copied to the appropriate sheet. This means that you would enter the data in columns B to F first and the value in column G last.
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
    ws = Split(Target.Offset(, -1), " ")(0)
    Range("B" & Target.Row).Resize(, 6).Copy Sheets(ws).Cells(Sheets(ws).Rows.Count, "A").End(xlUp).Offset(1)
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Copy and paste this macro into the worksheet code module. Do the following: right click the tab name for your MASTER SHEET sheet and click 'View Code'. Paste the macro into the empty code window that opens up. Close the code window to return to your sheet. This macro is triggered by a change in column G. When you enter a value in column G and press the ENTER key, the data in that row will be automatically copied to the appropriate sheet. This means that you would enter the data in columns B to F first and the value in column G last.
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
    ws = Split(Target.Offset(, -1), " ")(0)
    Range("B" & Target.Row).Resize(, 6).Copy Sheets(ws).Cells(Sheets(ws).Rows.Count, "A").End(xlUp).Offset(1)
    Application.ScreenUpdating = True
End Sub
I tried that and I am getting a runtime error on this line .... Range("B" & Target.Row).Resize(, 6).Copy Sheets(ws).Cells(Sheets(ws).Rows.Count, "A").End(xlUp).Offset(1)
 
Upvote 0
Replace this code
Code:
ws=Split(Target.Offset(,-1), “ “)(0)
with this code
Code:
ws=Split(Target.Offset(,-1), “ “)(0) & “ “ & ”Invoices”
 
Upvote 0
Replace this code
Code:
ws=Split(Target.Offset(,-1), “ “)(0)
with this code
Code:
ws=Split(Target.Offset(,-1), “ “)(0) & “ “ & ”Invoices”[/code

[/QUOTE]

Now I am getting this every time I try and add data into any cells on the master sheet
 

Attachments

  • Screenshot 2024-12-05 at 20.51.06.png
    Screenshot 2024-12-05 at 20.51.06.png
    92.2 KB · Views: 2
Upvote 0
I tested the macro on the data you posted and it worked properly. Can you upload a copy of your file to a free file sharing website and post a link to the file?
 
Upvote 0
Your file in dropbox has no data to test. It is pretty much useless in its current form.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,729
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