Help Modifying VBA

deanz

New Member
Joined
Apr 29, 2017
Messages
9
Hey All,

I have a few reports that i inherited and i need to change the code a bit..

Right now it tells excel that if the date is double clicked that it will run the macros and drop the data specific to that date.

I am looking to change this to automatically look for the first empty cell is column C that has the Monday through Friday in column A and drop the data from that date in automatically without the double click.

The code I am looking to modify is pretty the same for all of the reports. Help is greatly appreciated.

My end goal is to be able to make a VBS script that that will open the book, run this macro and update the book automatically without human intervention.

Code:
Private Sub Workbook_SheetBeforeDoubleClick(ByVal Sh As Object, ByVal Target As Range, Cancel As Boolean)
Application.Calculation = xlCalculationManual

If (ActiveCell.Column = 2) And (ActiveCell.Value < Date) Then
Do Until (ActiveCell.Value = Date) Or (ActiveCell.Row > 435)
RC = ActiveCell.Row
d = ActiveSheet.Cells(ActiveCell.Row, 1).Text
If ActiveSheet.Cells(ActiveCell.Row, 1).Text = "Monday" Then GoTo PopRow
If ActiveSheet.Cells(ActiveCell.Row, 1).Text = "Tuesday" Then GoTo PopRow
If ActiveSheet.Cells(ActiveCell.Row, 1).Text = "Wednesday" Then GoTo PopRow
If ActiveSheet.Cells(ActiveCell.Row, 1).Text = "Thursday" Then GoTo PopRow
If ActiveSheet.Cells(ActiveCell.Row, 1).Text = "Friday" Then GoTo PopRow
If ActiveSheet.Cells(ActiveCell.Row, 1).Text = "Saturday" Then GoTo PopRow
If ActiveSheet.Cells(ActiveCell.Row, 1).Text = "Sunday" Then GoTo PopRow
GoTo NoPopRow
PopRow:
   

ENT_SPLITS
CVG_SPLITS

NoPopRow:
ActiveSheet.Cells(ActiveCell.Row + 1, 2).Select
Loop
End If
ActiveSheet.Cells(1, 1).Select
Application.Calculation = xlCalculationAutomatic


End Sub
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,215,379
Messages
6,124,610
Members
449,174
Latest member
ExcelfromGermany

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