Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help With An If Then Statement 1

Status
Not open for further replies.

DrMingle

Technical User
May 24, 2009
116
US
I'm lost...towards the bottom I have put what I'm looking to do...

Can anyone help...?


Sub NPIEntry()

Dim objIENPI

'************Quotation
Dim myCell As Range
'************

Set objIENPI = CreateObject("InternetExplorer.Application")
objIENPI.Visible = False

'************************Application Activate
Set WshShell = CreateObject("WScript.Shell")
'******************************************

'************
'NPI Registry
objIENPI.navigate2 "objIENPI.Visible = True
Application.Wait (Now + TimeValue("0:00:1"))
While objIENPI.busy
Wend
objIENPI.Visible = True
WshShell.AppActivate "Name or Category"
'**************NPI Number
Application.Wait (Now + TimeValue("0:00:2"))
WshShell.AppActivate "Name or Category"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "{Tab}"
'******************************************
I'm tring to get the outcome of if cell I10 is greater than 0 then enter cell I10 and hit enter and if cell I10 has no value then I want cell I8 and I9 to sendkeys and enter.
'********************************************
If Range("I10") <> 0 Then
Name = Range("I10")
WshShell.SendKeys Name
End If
If Range("I10") = 0 Then
WshShell.SendKeys "{Tab}"
Name = Range("I8")
WshShell.SendKeys "{Tab}"
Name = Range("I9")
End If
WshShell.SendKeys "{Enter}"
End Sub
'
 
You wanted something like this ?
Code:
If Range("I10") <> 0 Then
  WshShell.SendKeys Range("I10")
Else
  WshShell.SendKeys "{Tab}"
  WshShell.SendKeys Range("I8")
  WshShell.SendKeys "{Tab}"
  WshShell.SendKeys Range("I9")
End If

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top