Modifiy a very small macro.. HELP!!

chaju

Board Regular
Joined
Mar 24, 2002
Messages
82
Hi, It would be big help if anyone can help me with this problem

Suppose in Cell A1:A30 (say) contains some date and with Cell A1: 25-Mar-02
And in Cell B1 I have fomula:
='c:My Document[Valuation 25-Mar-02.xls]Ingenium'!$E$4

NOTE: The file name has the date within to correspond with Cell A1.
The problem here is suppose I have to fill the B1 formula to B2,B3....B30 etc in and ensuring the file name within each formula has the date correspond to the date in the same row in Column A

Such as Cell A2: 26-Mar-02
So Cell B2:='c:My Document[Valuation 26-Mar-02.xls]Ingenium'!$E$4

SOMEONE has given me the solution via macro:

For i = 1 To Range("A1")
Range("B1").Offset(i-1, 0).Formula = "='c:My Document[Valuation " & Format(Range("A1").Offset(i-1, 0), "dd-mmm-yy") & "]Ingenium'!$E$4"
Next i

This solution works, but the loop seems endless,,, is there any way to stop the loop when reaching cell A30???

Thanks for you reply!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Hi.Please Try this.

Sub Test()
Dim rng As Range
For Each rng In Columns(1).SpecialCells(xlCellTypeConstants)
rng.Offset(, 1).Formula = _
"='C:My Document[Valuation " & rng.Text & ".xls]Ingenium'!R4C5"
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,487
Messages
6,113,937
Members
448,534
Latest member
benefuexx

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