pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
My code is working fine except for one thing.
If Range("C6") = "" Then MsgBox ("Your Actual time not entered!")
Exit Sub
does not work as i thought it to be. If Range("C6") = "" Then I want the MsgBox ("Your Actual time not entered!") pop up and then dont run my current code...but here it is not working....msg pops up and then runs my code...too
What am i doing wrong?
Please help.
Thanks
Ped
If Range("C6") = "" Then MsgBox ("Your Actual time not entered!")
Exit Sub
does not work as i thought it to be. If Range("C6") = "" Then I want the MsgBox ("Your Actual time not entered!") pop up and then dont run my current code...but here it is not working....msg pops up and then runs my code...too
What am i doing wrong?
Please help.
Thanks
Ped
Code:
Sub Macro2()
'
' Macro2 Macro
'
'
'
Sheets("sheet1").Select
Dim lonely As Long
lonely = Range("C" & Rows.Count).End(xlUp).Row
'I need help here. No error msg
If Range("C6") = "" Then MsgBox ("Your Actual time not entered!")
Exit Sub
Range("F2").Select
Selection.Copy
Range("D6").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Range("e6:e" & lonely).FormulaR1C1 = "=RC[-1]+RC[-2]"
Range("f6:f" & lonely).FormulaR1C1 = "=RC[-1]-RC[-2]"
Range("d7:d" & lonely).FormulaR1C1 = "=R[-1]C[1]+R3C6"
Application.CutCopyMode = False
Cells(1).Select
'copypaste
Range("D6:F42").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode = False
Range("A1").Select
End Sub