ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Morning,
Please can you check my code & advise what im missing.
Currently i get the RTE Block If without End If but i also believe there is another issue.
This works fine.
The code above doesnt take into consideration that the range I9:I18 could be empty.
So the code continues to run & i then see the msgbox "All figures have been transfered.
So i added the extra code in red below to it to first check but then this is where i now fail for it to run correctly.
Please can you check my code & advise what im missing.
Currently i get the RTE Block If without End If but i also believe there is another issue.
This works fine.
Rich (BB code):
Private Sub AprilStartButton_Click()
If WorksheetFunction.CountA(Range("B4:B13")) > 0 Then
answer = MsgBox("CELLS CONTAIN VALUES ALREADY, OVERWRITE THEM ?", vbCritical + vbYesNo)
If answer = vbNo Then
Exit Sub
End If
End If
Range("I9:I18").Copy Destination:=Range("B4:B13")
MsgBox "ALL FIGURES HAVE BEEN TRANSFERED", vbInformation, "MONTHS FIGUES MESSAGE"
Unload SUMMARYSHEETYEAR
Range("I9:I18").ClearContents
Range("I9").Select
End Sub
The code above doesnt take into consideration that the range I9:I18 could be empty.
So the code continues to run & i then see the msgbox "All figures have been transfered.
So i added the extra code in red below to it to first check but then this is where i now fail for it to run correctly.
Rich (BB code):
Private Sub AprilStartButton_Click()
If WorksheetFunction.CountA(Range("I9:I18")) = 0 Then
MsgBox "THERE ARE NO VALUES TO TRANSFER", vbCritical
Else
If WorksheetFunction.CountA(Range("B4:B13")) > 0 Then
answer = MsgBox("CELLS CONTAIN VALUES ALREADY, OVERWRITE THEM ?", vbCritical + vbYesNo)
If answer = vbNo Then
Exit Sub
End If
End If
Range("I9:I18").Copy Destination:=Range("B4:B13")
MsgBox "ALL FIGURES HAVE BEEN TRANSFERED", vbInformation, "MONTHS FIGUES MESSAGE"
Unload SUMMARYSHEETYEAR
Range("I9:I18").ClearContents
Range("I9").Select
ActiveWorkbook.Save
End Sub