W.E.B
asked on
vba to fill cells
Hello,
can you please help with a vba code (I need to sue in excel 2007) that can find last column used / last row used
then fill blank / empty cells with 0
Please see sample attached.
sample.xlsx
can you please help with a vba code (I need to sue in excel 2007) that can find last column used / last row used
then fill blank / empty cells with 0
Please see sample attached.
sample.xlsx
ASKER
Thanks,
I get error
variable not defined
Set myRange =
thakns
I get error
variable not defined
Set myRange =
thakns
Try simply
Sub fillzeros()
ActiveSheet.UsedRange.Spec ialCells(x lCellTypeB lanks).Val ue = 0
End Sub
Sub fillzeros()
ActiveSheet.UsedRange.Spec
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Rgonzo1971,
it worked.
I made a mistake with the columns,
I have a gab between 2 sections (see attached sample)
in sample attached, can it stop at Column "Y"
ie, stop at last column used before gab
I tried to use
Set myRange = Range(Cells(Rows.Count, 1).End(xlUp), Cells(1, Columns.Count).End(xlToRig ht))
but didnt work,
thanks again,
sample.xlsx
it worked.
I made a mistake with the columns,
I have a gab between 2 sections (see attached sample)
in sample attached, can it stop at Column "Y"
ie, stop at last column used before gab
I tried to use
Set myRange = Range(Cells(Rows.Count, 1).End(xlUp), Cells(1, Columns.Count).End(xlToRig
but didnt work,
thanks again,
sample.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you
pls try
Open in new window
Or the version with SpecialCells which is quickerOpen in new window
Regards