Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to copy a single formula cell to a range of cells. I can do it with
a range statement I learned of yesterday but I want to use cell notation so I can make the cell copy dynamic. How can I do it? For reference, the formula in my cell to copy from looks like this: =IF(SectionData!$I3='Transformed data'!BG$2,1,0). Thanks in advance! Kevin This works great but I'd like to use cell notation instead. ' Copies a single formula cell to a range of cells. oBook.Worksheets("Transformed data").Range("BG4", "CE321").Formula = _ oBook.Worksheets("Transformed data").Range("BG3").Formula In this experiment I get the error "Object variable or With Block variables not set". I haven't figured how to solve the error message but this is the formula I really need to make work oBook.Worksheets("Transformed data").Range(Cells(3, 58), Cells(320, 58 + iCitizenshipCount)).Formula = _ oBook.Worksheets("Transformed data").Range("BG3").Formula In this experiment the cells copied but it copied the exact formula to each cell, the formula cell references did not change. Also, this is very slow! For X = 3 To 320 For Y = 1 To iCitizenshipCount oSheet.Cells(X, 58 + Y).Formula = oBook.Worksheets("Transformed data").Range("BG3").Formula Next Next Here is how I clear and copy data to the spreadsheet with no problems: ' Clear Parameters: Citizenship Section Set oSheet = oBook.Worksheets("Transformed data") oSheet.Range("BG2:CE2").Value = "" oSheet.Range("BH3:CE3").Value = "" oSheet.Range("BG4:CE320").Value = "" 'Transfer the array to the worksheet oSheet.Range("BG2:CE2").Resize(1, iCitizenshipCount).Value = aCitizenshipTransformedData |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I add a formula to a range of cells | New Users to Excel | |||
Copy formula into multiple cells without changing range | Excel Worksheet Functions | |||
How to use macros to copy a range of cells which can exclude some cells which I didn't want to be copied? | Excel Worksheet Functions | |||
formula to copy last positive number in range of cells | Excel Worksheet Functions | |||
Copy cells into range of cells until cell change | Excel Worksheet Functions |