Need VB code

Joined
Feb 15, 2018
Messages
18
Hi. I have zero knowledge of excel VBA.

I am working on a project. From a seperate program i am able to export reports into an excel spreadsheet.
I want to copy and paste the spreadsheet into another excel workbook that has a Macro waiting to be used.
The report results are always the same number of columns, but the number of rows will always be dynamic.

I want a Macro run through a button to do the following.

Compare the results (which is a date) in column B (starting in row 5) to (the date) that is in C2.
I would like the results to be in column F.

The basic formula i have been using is:
=IF ($C $2>B5, "Over", "In")

Any help would be greatly appreciated.
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Spaceballs, first off welcome to the site.

As for VBA and a button I too struggled with something similar trying to run VBA on imported data from a 2nd workbook one that would not change, 'pushing my VBA on to a new data WB from an old WB and ended up just saving my Macro into personal.xls and creating a button on the toolbar.

also looking at your formula you have cell $C$2 locked and B5 is not are you only comparing 2 cells or do you want B5, B6, B7...all to compare to C2 with results in F5, F6, F7...
 
Upvote 0

Forum statistics

Threads
1,224,830
Messages
6,181,227
Members
453,025
Latest member
Hannah_Pham93

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