Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have multiple workbooks in the same folder and I want to add a formula from
cell B2 to the end of the data listed in column A. The formula would be the same for all workbooks. How would I do this with VBA? Thanks, Barb Reinhardt |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
set rng = Range(cells(2,1),cells(2,1).end(xldown))
rng.offset(0,1).Formula = "=A2^.5" would be the basic code. -- Regards, Tom Ogilvy "Barb Reinhardt" wrote in message ... I have multiple workbooks in the same folder and I want to add a formula from cell B2 to the end of the data listed in column A. The formula would be the same for all workbooks. How would I do this with VBA? Thanks, Barb Reinhardt |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How would I open each workbook to add it?
"Tom Ogilvy" wrote: set rng = Range(cells(2,1),cells(2,1).end(xldown)) rng.offset(0,1).Formula = "=A2^.5" would be the basic code. -- Regards, Tom Ogilvy "Barb Reinhardt" wrote in message ... I have multiple workbooks in the same folder and I want to add a formula from cell B2 to the end of the data listed in column A. The formula would be the same for all workbooks. How would I do this with VBA? Thanks, Barb Reinhardt |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Seems like you asked this a while ago, but perhaps not
Dim sPath as String Dim sName as String Dim bk as Workbook Dim sh as Worksheet Dim rng as Range sPath = "C:\Myfolder1\Myfolder2\" sName = dir(sPath & "*.xls") do while sName < "" set bk = Workbooks.Open(sPath & sname) for each sh in bk.worksheets set rng = sh.Range(sh.cells(2,1),sh.cells(2,1).end(xldown)) rng.offset(0,1).Formula = "=A2^.5" next bk.close Savechanges:=True sname = Dir() Loop if you only are going to work on a single specific sheet, adjust the code to reflect that. set sh = bk.Worksheets(1) set rng = sh.Range(sh.cells(2,1),sh.cells(2,1).end(xldown)) rng.offset(0,1).Formula = "=A2^.5" bk.close Savechanges:=True -- Regards, Tom Ogilvy "Barb Reinhardt" wrote in message ... I have multiple workbooks in the same folder and I want to add a formula from cell B2 to the end of the data listed in column A. The formula would be the same for all workbooks. How would I do this with VBA? Thanks, Barb Reinhardt |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I may have asked a similar question, but I'm still REAL fuzzy on VBA.
Thanks for humoring me. :) Barb "Tom Ogilvy" wrote: Seems like you asked this a while ago, but perhaps not Dim sPath as String Dim sName as String Dim bk as Workbook Dim sh as Worksheet Dim rng as Range sPath = "C:\Myfolder1\Myfolder2\" sName = dir(sPath & "*.xls") do while sName < "" set bk = Workbooks.Open(sPath & sname) for each sh in bk.worksheets set rng = sh.Range(sh.cells(2,1),sh.cells(2,1).end(xldown)) rng.offset(0,1).Formula = "=A2^.5" next bk.close Savechanges:=True sname = Dir() Loop if you only are going to work on a single specific sheet, adjust the code to reflect that. set sh = bk.Worksheets(1) set rng = sh.Range(sh.cells(2,1),sh.cells(2,1).end(xldown)) rng.offset(0,1).Formula = "=A2^.5" bk.close Savechanges:=True -- Regards, Tom Ogilvy "Barb Reinhardt" wrote in message ... I have multiple workbooks in the same folder and I want to add a formula from cell B2 to the end of the data listed in column A. The formula would be the same for all workbooks. How would I do this with VBA? Thanks, Barb Reinhardt |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula for adding a cell in multiple workbooks | Excel Worksheet Functions | |||
Adding a Row to Multiple Workbooks | Excel Discussion (Misc queries) | |||
Adding multiple workbooks together | Excel Discussion (Misc queries) | |||
adding certain cells in multiple worksheets in multiple workbooks | Excel Worksheet Functions | |||
Adding cells from multiple workbooks | Excel Discussion (Misc queries) |