Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi all,
I've got the following macro, which I use in another project, to insert N rows and copy three formulas in F9:H9. The macro I have copies down each formula into cells F10:F400, G10:G400, etc..In a new project, I want to do a similar thing, except I only want one formula [a max()+1 formula in J2] and copy the cell contents (NOT the formula!) into the J column of my new row.
Anywho... here's the original macros. Only the last line would need changing.
Sub InsertRow()
Dim Rng, n As Long, k As Long
Application.ScreenUpdating = False
Rng = InputBox("Enter number of rows required.")
If Rng = "" Then Exit Sub
Range(ActiveCell, ActiveCell.Offset(Val(Rng) - 1, 0)).EntireRow.Insertk = ActiveCell.Offset(-1, 0).Row
n = Cells(k, 2).End(xlToLeft).Column
Range(Cells(k, 2), Cells(k + Val(Rng), n)).FillDownCopySideFormulaDown
End Sub
Sub CopySideFormulaDown()Range("J2").Select.Value
Selection.AutoFill Destination:=Range("XXX"), Type:=xlFillDefault
Thx

Is there some code missing? There is no End Sub for your CopySideFormulaDown macro, so we don't if you've given us the complete macro.
In addition, what is
Range("J2").Select.Value
supposed to do? I am not familiar with the Select.Value syntax and I can't find any reference to it's use. The code gives me an Run-time error '424' Object Required when the code reaches that line.

![]() |
Batch file renaming
|
Alt-F1 hijacked
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |