Hey guys,
I am currently trying to expand some formula with VBA but dont really have deep knowledge about it.
I found the following code and if used as intended (Double click on a cell), it works fine.
However, when I try to change it to my needs, I always get error messages.
Here is what I want to to do:
Klick on a button and then expand formulas in a sheet ("INVOICE") for the number of rows in Sheet "Bondout List".
So i tried to do the following:
Count the number of rows for column "E" on Sheet "Bondout List" by this:
and use this value instead of the "3".
After that I tried to change the "Target" stuff because I want Row 9 to be used but I always get "Object required". So I think, its only depending on getting the stuff with the target cleared.
Hope you can help me with a little change of the code.
Cheers
Jan
I am currently trying to expand some formula with VBA but dont really have deep knowledge about it.
I found the following code and if used as intended (Double click on a cell), it works fine.
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True 'Eliminate Edit status due to doubleclick
[I][COLOR=#339966]target[/COLOR][/I].Offset(1).EntireRow.Resize([B]3[/B]).Insert
[I][COLOR=#339966]target[/COLOR][/I].EntireRow.Copy [I][COLOR=#339966]target[/COLOR][/I].EntireRow.Offset(1).Resize([B]3[/B]).EntireRow
on error resume next
[I][COLOR=#339966]target[/COLOR][/I].Offset(1).EntireRow.Resize([B]3[/B]).SpecialCells(xlConstants).ClearContents
on error goto 0
End Sub
However, when I try to change it to my needs, I always get error messages.
Here is what I want to to do:
Klick on a button and then expand formulas in a sheet ("INVOICE") for the number of rows in Sheet "Bondout List".
So i tried to do the following:
Count the number of rows for column "E" on Sheet "Bondout List" by this:
Code:
Dim varlastRow As Long
varlastRow = Worksheets("Bondout List").Cells(65536, 5).End(xlUp).Row - 9
After that I tried to change the "Target" stuff because I want Row 9 to be used but I always get "Object required". So I think, its only depending on getting the stuff with the target cleared.
Hope you can help me with a little change of the code.
Cheers
Jan