ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,731
- Office Version
- 2007
- Platform
- Windows
The code in use is shown below.
Im in need of some help please for when the code checks the active cell.
I have in place the code shown in Red below if it has no value / empty etc
But can you advise what i need to put should it have a value etc & where i need to put it.
I did try this but it wasnt happening at the correct point.
Im in need of some help please for when the code checks the active cell.
I have in place the code shown in Red below if it has no value / empty etc
But can you advise what i need to put should it have a value etc & where i need to put it.
I did try this but it wasnt happening at the correct point.
Rich (BB code):
If ActiveCell.Value <> 0 Then
MsgBox "CELL ISNT EMPTY"
End If
Rich (BB code):
Private Sub TEST_Click()
Dim answer As Integer
Dim rng As Range
Dim cell As Range
Dim findString As String
Dim sPath As String, strFileName As String
Dim srcWS As Worksheet, destWS As Worksheet
Set srcWS = ActiveWorkbook.Worksheets("INV")
Set destWS = ActiveWorkbook.Worksheets("DATABASE")
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DR\DR COPY INVOICES\" & Range("L4").Value & ".pdf"
If Range("L18") = "" Then
MsgBox ("PLEASE SELECT A PAYMENT TYPE "), vbCritical, "PAYMENT TYPE WAS NOT SELECTED"
Range("L18").Select
Exit Sub
End If
strFileName = "C:\Users\Ian\Desktop\REMOTES ETC\DR\DR COPY INVOICES\" & Range("L4").Value & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "INVOICE " & Range("L4").Value & " WAS NOT SAVED AS IT ALLREADY EXISTS" & vbNewLine & vbNewLine & "PLEASE CHECK FILE IN FOLDER THAT WILL NOW OPEN.", vbCritical + vbOKOnly, "INVOICE NOT SAVED MESSAGE"
VBA.Shell "explorer.exe /select, " & "" & strFileName & "", vbNormalFocus
Exit Sub
End If
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, fileName:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False
End With
With Sheets("DATABASE")
Worksheets("DATABASE").Activate
End With
Set rng = ActiveSheet.Columns("A:A")
findString = Worksheets("INV").Range("G13").Value
Set cell = rng.Find(What:=findString, LookIn:=xlFormulas, _
LookAt:=xlWhole, MatchCase:=False)
If cell Is Nothing Then
MsgBox "NO CUSTOMER WAS FOUND"
Else
With Sheets("DATABASE")
cell.Select
ActiveCell.Offset(0, 15).Select
End With
If ActiveCell.Value = "" Then
TransferInvoiceNumber.Show
End If
End If
With Sheets("DATABASE")
Worksheets("INV").Activate
With ActiveSheet
' ActiveWindow.SelectedSheets.PrintOut copies:=1
MsgBox "NO PRINTING 1ST MSG"
answer = MsgBox("INVOICE HAS NOW BEEN SAVED" & vbNewLine & vbNewLine & "DID THE INVOICE PRINT OK FOR YOU ?", vbInformation + vbYesNo, "INVOICE PRINT OK MESSAGE")
If answer = vbNo Then
' ActiveWindow.SelectedSheets.PrintOut copies:=1
MsgBox "NO PRINTING 2ND MSG"
Exit Sub
Else
Range("L4").Value = Range("L4").Value + 1
Range("G27:L36").ClearContents
Range("G46:G50").ClearContents
Range("L18").ClearContents
Range("G13").ClearContents
Range("G13").Select
ActiveWorkbook.Save
End If
End With
End With
End Sub