Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 19
Default Change import cell reference

Hello,

I wonder if you could help? I am importing data from reports
generated each day, which must be retained. The file name therefore
includes the date. To save me updating the 200+ cells with the
correct calender day, is there a way I can make this process quicker?

i.e. if this is what the foluma used to read:

=[Book1]Sheet1_01/06/08!$A$1

I want to use something like:

=[Book1]Sheet1_ "+B1+" !$A$1 // Where B1 would equal 01/06/08.

Thank you!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,533
Default Change import cell reference

Hi

Try this macro on a copy of your workbook.

Sub ChangeFormula()
Dim TargetRange As Range
Dim OldFormula As String
Dim NewFormula As String
Dim DateStr As String
DateStr = Format(Date, "dd/mm/yy")
Set TargetRange = Range("A1:A10")

For Each cell In TargetRange
OldFormula = cell.Formula
lFormula = Left(OldFormula, Application.WorksheetFunction.Search("_",
OldFormula))
rFormula = Mid(OldFormula, Application.WorksheetFunction.Find("!",
OldFormula))
NewFormula = lFormula & DateStr & rFormula
cell.Formula = NewFormula
Next
End Sub

Regards,
Per

"AMaleThing" skrev i meddelelsen
...
Hello,

I wonder if you could help? I am importing data from reports
generated each day, which must be retained. The file name therefore
includes the date. To save me updating the 200+ cells with the
correct calender day, is there a way I can make this process quicker?

i.e. if this is what the foluma used to read:

=[Book1]Sheet1_01/06/08!$A$1

I want to use something like:

=[Book1]Sheet1_ "+B1+" !$A$1 // Where B1 would equal 01/06/08.

Thank you!


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 19
Default Change import cell reference

On Jun 4, 12:59*pm, "Per Jessen" wrote:
Hi

Try this macro on a copy of your workbook.

Sub ChangeFormula()
Dim TargetRange As Range
Dim OldFormula As String
Dim NewFormula As String
Dim DateStr As String
DateStr = Format(Date, "dd/mm/yy")
Set TargetRange = Range("A1:A10")

For Each cell In TargetRange
* * OldFormula = cell.Formula
* * lFormula = Left(OldFormula, Application.WorksheetFunction.Search("_",
OldFormula))
* * rFormula = Mid(OldFormula, Application.WorksheetFunction.Find("!",
OldFormula))
* * NewFormula = lFormula & DateStr & rFormula
* * cell.Formula = NewFormula
Next
End Sub

Regards,
Per

"AMaleThing" skrev i ...



Hello,


I wonder if you could help? *I am importing data from reports
generated each day, which must be retained. *The file name therefore
includes the date. *To save me updating the 200+ cells with the
correct calender day, is there a way I can make this process quicker?


i.e. if this is what the foluma used to read:


=[Book1]Sheet1_01/06/08!$A$1


I want to use something like:


=[Book1]Sheet1_ *"+B1+" * !$A$1 * * *// Where B1 would equal 01/06/08.


Thank you!- Hide quoted text -


- Show quoted text -


Thank you for your suggest, but is it possible you could tell me what
this does? It doesn't look like what I was expecting.
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,533
Default Change import cell reference

Hi

The macro needs to be insert into the macro editor. Save a copy of the
workbook to test on.

To open the VBA Macro Editor hit Alt+F11.

Now goto Insert Module. This opens a blank code page where you copy to
macro to.

In the statement Set TargetRange... Change the range to the range holding
the formulas that needs to be edited.

Hit F5 to run the macro. Go back to the workbook and check if the formulas
is as desired.

Hopes this helps

regards,
Per


"AMaleThing" skrev i meddelelsen
...
On Jun 4, 12:59 pm, "Per Jessen" wrote:
Hi

Try this macro on a copy of your workbook.

Sub ChangeFormula()
Dim TargetRange As Range
Dim OldFormula As String
Dim NewFormula As String
Dim DateStr As String
DateStr = Format(Date, "dd/mm/yy")
Set TargetRange = Range("A1:A10")

For Each cell In TargetRange
OldFormula = cell.Formula
lFormula = Left(OldFormula, Application.WorksheetFunction.Search("_",
OldFormula))
rFormula = Mid(OldFormula, Application.WorksheetFunction.Find("!",
OldFormula))
NewFormula = lFormula & DateStr & rFormula
cell.Formula = NewFormula
Next
End Sub

Regards,
Per

"AMaleThing" skrev i
...



Hello,


I wonder if you could help? I am importing data from reports
generated each day, which must be retained. The file name therefore
includes the date. To save me updating the 200+ cells with the
correct calender day, is there a way I can make this process quicker?


i.e. if this is what the foluma used to read:


=[Book1]Sheet1_01/06/08!$A$1


I want to use something like:


=[Book1]Sheet1_ "+B1+" !$A$1 // Where B1 would equal 01/06/08.


Thank you!- Hide quoted text -


- Show quoted text -


Thank you for your suggest, but is it possible you could tell me what
this does? It doesn't look like what I was expecting.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shortcut to change change cell reference to Absolute reference? richk Excel Worksheet Functions 12 December 5th 09 12:24 AM
change change cell reference to Absolute reference art Excel Discussion (Misc queries) 5 March 13th 08 02:41 AM
how do i reference a cell with url for web query import? fkendrick Excel Worksheet Functions 1 January 2nd 07 12:23 PM
Cell Reference Change MDW Excel Worksheet Functions 6 March 28th 06 06:02 PM
Change workbook sheet reference using cell A1 to change a vairable Reed Excel Worksheet Functions 4 January 20th 05 07:15 PM


All times are GMT +1. The time now is 11:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"