Emily Strzelecki
Emily Strzelecki

Reputation: 23

Input box prompting for second data entry to store data, can we make it store on the first entry?

I am trying to put an activex textbox over a cell (B23), which is hiding the text cell with the secure data. The textbox has the passwordchar set to *. When I put the input box function in the textbox it pops up when they start to type, then when I push okay the box clears and asks me to reenter my data then it saves to B23. Is there a way to make this work on the first time, or if on the second popup have it say "please verify your entry"?

I've tried linking the cell to B23 and taking the range off, but its not storing the data.

Private Sub TextBox1_Change()
  Dim response As String
  response = InputBox(Prompt:="Please enter the EIN/Tax Payer ID with no dashes or spaces. For security purposes this information will disappear after entry and be stored securely.", Title:="Tax Payer Data", Default:="Enter Tax Payer ID here")
   Range("B23").Value = response
   Exit Sub
End Sub

Is there a way to make this work on the first time, or if on the second popup have it say "please verify your entry"? I am trying to hide sensitive data (EIN, bank account number, etc) after it is entered, but keeping the starting "0"'s and the excel sheet is already formatted to show zeros. So whether we stick with the text box over the cell or something different I am open to anything.

Upvotes: 0

Views: 50

Answers (1)

Jitendra Singh
Jitendra Singh

Reputation: 191

GotFocus event should help you

Private Sub TextBox1_GotFocus()
    Dim response As String
  response = InputBox(Prompt:="Please enter the EIN/Tax Payer ID with no dashes or spaces. For security purposes this information will disappear after entry and be stored securely.", Title:="Tax Payer Data", Default:="Enter Tax Payer ID here")
   Range("G1").Value = response
   TextBox1.Text = response
   Exit Sub
End Sub

Upvotes: 1

Related Questions