Update Work Book with a macro

tkraju

Board Regular
Joined
Apr 1, 2009
Messages
79
Office Version
  1. 2016
Platform
  1. Windows
I have a w/book named as Sales Report xlsm file > file path > C:\Users\Raju\Sales Report.xlsm

I have to update this w/book data with 2 csv files which I down load > file paths are >>>
C:\Users\Raju\Dropbox\PC\Desktop\Mumbai.csv > > variable data exisis *
C:\Users\Raju\Dropbox\PC\Desktop\New Delhi.csv >> variable data exists **
I need a macro to update Sales Report using above source csv files.

Task: Check Mumbai csv file data exists or not in Sales Report w/book > If Mumbai csv sheet “A2” date exists in Sales Report sheet entire column B > macro gives msg “Data Already Exists” > Exit macro after accepting msg result > If Mumbai csv sheet “Ä2” date not found in Sales Report column B > Copy variable data of Mumbai csv sheet (“A2: E”) and paste them in Sales Report last row (B :F) > Copy variable data of New Delhi csv sheet(“Ä2:E”) and paste them in Sales Report last row(H:L) > Msg “sheet Updated”. > End Sub.

If I rerun this macro > macro should give msg “Data Already Exists”
Macro has to run from Sales Report w/book
Csv files * and ** in both files variable data exists some times one row and some times more than 2 rows.
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
You'll have to help me out if I can assist.
I need a macro to update Sales Report using above source csv files.
What does update mean? You'll have to be more specific.

What worksheet(s) in the workbook are updated? Are there two worksheets: one each for Mumbai and New Delhi? How do the worksheet(s) get updated.

It sounds like there is a third worksheet that is named Sales Report too?

Where does the csv data get placed?
Task: Check Mumbai csv file data exists or not in Sales Report w/book
What does the workbook have in it that indicates that the "csv file data exists"?

Sorry but this is confusing.
If Mumbai csv sheet “A2” date exists in Sales Report sheet entire column B > macro gives msg “Data Already Exists”

Might you share the workbook and csv files with fake but realistic data? Put files into Dropbox. Use the link icon above the message area.
 
Upvote 0
You'll have to help me out if I can assist.

What does update mean? You'll have to be more specific.

What worksheet(s) in the workbook are updated? Are there two worksheets: one each for Mumbai and New Delhi? How do the worksheet(s) get updated.

It sounds like there is a third worksheet that is named Sales Report too?

Where does the csv data get placed?

What does the workbook have in it that indicates that the "csv file data exists"?

Sorry but this is confusing.


Might you share the workbook and csv files with fake but realistic data? Put files into Dropbox. Use the link icon above the message area.
Thank you. I have clearly mentioned w/book Sales Report (Destination w/book) has to be updated using Mumbai.csv and New Delhi csv files (source files). Before updating Sales Report W/book > check whether Mumbai.csv file data exists or not in Sales Report w/book > Conditional check to this initial task is to check Mumbai csv file A2 ( date field) exists or not in Sales Report w/book Column B> if the date(Mumbai csv A2 date value) exists in Sales Report > that means the W/book already updated > If the said date not exists in Sales Report w/book > Copy dynamic data ranges from Mumbai csv & New delhi csv and paste them in Sales report destination columns/rows. Mumbai csv and New delhi csv files data varies every day as I download them daily or few days interval.
 
Upvote 0
We have a language issue. And you did not answer my questions.

Start by answering these questions: How many worksheets are in the workbook? What are their names?

Try showing the data. Use Mr. Excel's excellent add-in called XL2BB that enables you to post a portion of the workbook. Show us what cell(s) contain the date(s).
 
Upvote 0

Forum statistics

Threads
1,224,829
Messages
6,181,218
Members
453,024
Latest member
Wingit77

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