vba macro auto fill when connection updates

dhughes85

New Member
Joined
Apr 10, 2015
Messages
19
Hi all,

I have a sharepoint survey with a basic refresh macro I run once an hour to get new responses from. This is housed in Columns D-AL of an excel worksheek (it's a big survey)

Column D is the response date/time and in Column A-C I have the following

Time Day Week Column D
=d2 =weekday(d2,2) =weeknum(d2,2) sometime&somedate


What I want to do is create a macro that autofills the formulas from cells A-C when the data in column D grows (so if a refresh puts data into D3, cells A3-C3 autofill the formulas from A2-C2)

I was looking here and re-appropriated a macro from a query in another thread:



Sub autofill()
Dim MyCol As Long, MyRow As Long, LR As Long
MyCol = Cells.Find(What:="Week").Column
MyRow = Cells.Find(What:="Week").Row
LR = Cells(Rows.Count, MyCol - 1).End(xlUp).Row
Range(Cells(MyRow + 1, MyCol), Cells(LR, MyCol)).FormulaR1C1 = "=Weeknum(rc[1],2)"
MyCol = Cells.Find(What:="Day").Column
MyRow = Cells.Find(What:="Day").Row
LR = Cells(Rows.Count, MyCol - 1).End(xlUp).Row
Range(Cells(MyRow + 1, MyCol), Cells(LR, MyCol)).FormulaR1C1 = "=Weekday(rc[2],2)"
MyCol = Cells.Find(What:="Time").Column
MyRow = Cells.Find(What:="Time").Row
LR = Cells(Rows.Count, MyCol - 1).End(xlUp).Row
Range(Cells(MyRow + 1, MyCol), Cells(LR, MyCol)).FormulaR1C1 = "=rc[3]"
End Sub


which worked brilliantly to populate the existing data (down as far as row 5253...its a big survey with lots of responses :S) but hasn't grown, and isn't working, when I've refreshed the connection on column D.

What do I need to do to make it grow automatically?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,203,186
Messages
6,053,984
Members
444,696
Latest member
VASUCH

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