Input Box only if a cell is blank
Jim, this is fantastic! It's working exactly how I need it to.
Jim, Dave, Gord, FSt1, thank you all so much for your help! I really
appreciate it!!
"Jim Thomlinson" wrote:
You need to capture 2 events. If the sheet is opened on the summary tab then
you want to add the client name... The other is if you select the summary
tab... If it were me I would write a sub to add the name (if appropriate) and
then just call it from the on open event and from the sheet activate event...
Something like this...
Option Explicit
Private Sub Workbook_Open()
Call AddClient(ActiveSheet)
End Sub
Private Sub Workbook_SheetActivate(ByVal sh As Object)
Call AddClient(sh)
End Sub
Private Sub AddClient(ByVal sh As Worksheet)
With sh
If .Name = "Summary" Then
If Trim(.Range("A4").Value) = "" Then
.Range("A4").Value = InputBox("Please input the Client's Name")
End If
End If
End With
End Sub
--
HTH...
Jim Thomlinson
"Audrey" wrote:
Hi, I'm a VBA noob. At most I glean from the genius on this forum and copy
and paste your functions into my workbooks. I took a modified version of
this code directly from this forum, but I don't know how to change it so that
the input box will only pop up if the cell is blank.
Option Explicit
Private Sub Workbook_Open()
Dim ClientName As String
ClientName = InputBox("Please input the Client's Name")
Worksheets("Summary").Range("A4") = ClientName
End Sub
Also I only need the input box to pop up if the user is on the tab titled
"Summary," not as the book is opened.
Any help is greatly appreciated!
Thanks!
|