J
juan
Hello,
I get the following error Run-time error Method "UsedRange
of Object_Worksheet' failed. Before it has been working
but not sure if I should reinstall Excel.
This is the code:
Dim Firstrow As Long
Dim lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationAutomatic
.ScreenUpdating = False
End With
Firstrow = ActiveSheet.UsedRange.Cells(1).Row
lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow -
1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = lastrow To Firstrow Step -1
If IsError(.Cells(Lrow, "A").Value) Then
'Do nothing, This avoid a error if there
is a error in the cell
ElseIf .Cell(Lrow, "A").Value= "Semi Total" Then
.Cells(Lrow, "A").Value = ""
.Cells(Lrow, "A").Offset(0, 1).Value = "Semi
Total"
ElseIf .Cells(Lrow, "A").Value = "SIL Total" Then
.Cells(Lrow, "A").Value = ""
.Cells(Lrow, "A").Offset(0, 1).Value = "SIL Total"
End If
Next
End With
End Sub
When I do the debug it highlights
Firstrow = ActiveSheet.UsedRange.Cells(1).Row
So not sure what to do. Any suggestionw would be
appreciated.
Thanks,
juan
I get the following error Run-time error Method "UsedRange
of Object_Worksheet' failed. Before it has been working
but not sure if I should reinstall Excel.
This is the code:
Dim Firstrow As Long
Dim lastrow As Long
Dim Lrow As Long
Dim CalcMode As Long
With Application
CalcMode = .Calculation
.Calculation = xlCalculationAutomatic
.ScreenUpdating = False
End With
Firstrow = ActiveSheet.UsedRange.Cells(1).Row
lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow -
1
With ActiveSheet
.DisplayPageBreaks = False
For Lrow = lastrow To Firstrow Step -1
If IsError(.Cells(Lrow, "A").Value) Then
'Do nothing, This avoid a error if there
is a error in the cell
ElseIf .Cell(Lrow, "A").Value= "Semi Total" Then
.Cells(Lrow, "A").Value = ""
.Cells(Lrow, "A").Offset(0, 1).Value = "Semi
Total"
ElseIf .Cells(Lrow, "A").Value = "SIL Total" Then
.Cells(Lrow, "A").Value = ""
.Cells(Lrow, "A").Offset(0, 1).Value = "SIL Total"
End If
Next
End With
End Sub
When I do the debug it highlights
Firstrow = ActiveSheet.UsedRange.Cells(1).Row
So not sure what to do. Any suggestionw would be
appreciated.
Thanks,
juan