如果单元格为空,请填写其他单元格的文本数据

时间:2019-03-30 18:53:57

标签: excel vba if-statement userform

这对您的专家而言可能很简单。我已经尝试了很多方法,并且在代码中的许多位置尝试过,但是没有一个对我有用。请帮忙!

我要做的就是从 CELL RANGE B4:B4000 获取数据,然后自动复制到 CELL RANGE J4:J4000 应该 电池范围J4:J4000

仅供参考:数据是通过用户表格输入的。

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
~~~~

2 个答案:

答案 0 :(得分:0)

to = ChannelAccount(id=to_user_id)

bot_channel = ChannelAccount(id=bot_id)
activity_reply = Activity(type=ActivityTypes.message, channel_id='msteams',from_property=bot_channel,recipient=to,text=message)

credentials=MicrosoftAppCredentials(app_id, app_password)
JwtTokenValidation.authenticate_request(activity_reply, "Authorization", credentials)
# That's where you pass the tenant id
reply_conversation_params=ConversationParameters(bot=bot_channel, members=[to], activity=activity_reply, channel_data={ 'tenant': { 'id': tenant_id } })
connector = ConnectorClient(credentials, base_url='https://smba.trafficmanager.net/uk/')

# Create conversation
conversation = connector.conversations.create_conversation(reply_conversation_params)
# And send it
connector.conversations.send_to_conversation(conversation.id, activity_reply)

答案 1 :(得分:0)

相关问题