samedi 30 mars 2019

If Cell Is Blank, Fill With Other Cell’s Text Data

This is probably simple for you experts out there. I've tried so many ways, and in so many locations w/in the code, but none are working for me. Please help!

All I’m trying to do is get data from CELL RANGE B4:B4000 to copy automatically to CELL RANGE J4:J4000 should CELL RANGE J4:J4000 be empty.

FYI: Data being inputted via a user-form.

Option Explicit

Private Sub CmdButton_CONTINUE1_Click() 

Dim TargetRow As Integer
Dim FullName As String   'Variable for FULL NAME = CELL RANGE J4:J4000
Dim QBFileName As String   'Variable Quick Books File Name = CELL RANGE B4:B4000
Dim UserMessage As String

FullName = Txt_Client_First_Name & " " & Txt_Client_LAST_Name
QBFileName = Txt_QB_File_Name

'begin check if EDIT or ADD New Entry Mode
If Sheets("Engine").Range("B4").Value = "NEW" Then  'ADD New Entry Mode


'BEGINS VALIDATION CHECK: IF in "ADD New Entry Mode" mode to prevent duplicate FULL NAME J Column entries

If Application.WorksheetFunction.CountIf(Sheets("Database").Range("J3:J4000"), FullName) > 0 Then

MsgBox "Client's Full Name already exists", 0, "Check" 
Exit Sub 

End If  'ends validation check OF Duplicate FULLNAME (J Column)


'BEGINS VALIDATION CHECK: IF in "ADD New Entry Mode" to prevent duplicate QBFileName B Column entries

If Application.WorksheetFunction.CountIf(Sheets("Database").Range("B3:B4000"), QBFileName) > 0 Then

MsgBox "QuickBooks File Name already exists", 0, "Check" 
Exit Sub 

End If
~~~~

Aucun commentaire:

Enregistrer un commentaire