Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Storing input to a cell in excel

Storing input to a cell in excel

Scheduled Pinned Locked Moved Visual Basic
helpdebuggingregex
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    skydivenut
    wrote on last edited by
    #1

    :~ Okay, This is proably a no brainer for you folks but I am new to programming at this level, so please bear with me; The Objective; to save the users input string to a cell after it has been verified. The problem; when I run the code to debug it I currently get a "Runtime error 9 -subscript out of range" . I would also ask that there must be a better way to store the password all suggestions are welcomed on that one and can anyone tell me what I need to use to mask the users input with a single repeated character. Here's my current code: Private Sub CommandButton2_Click() Dim Tb As Integer, PwdSv As String, Field As String Set Workbooks("XTSR").Sheets("Sheet14").Range("C17").Value = PwdSv Set Workbooks("XTSR").Sheets("Sheet14").Range("C6:C11").Value = Field For Tb = 1 To 6 If Field = "" And PwdSv = "" Then Call password_new Next Tb If PwdSv <> "" Then Call Password End Sub Public Sub password_new() Dim Default, Msg1, Msg2, Style, Title1, Title2, PwdSv RESTART: Default = "" Msg1 = "Enter a Password" Msg2 = "Re-enter Password to Confirm it" Msg3 = "Entries Did Not Match, Try Again!" Set PwdSv = Workbooks("XTSR").Sheets("Sheet14").Range("C17").Value Title1 = "Password Confirmation" Title2 = "Password Error" Style = vbOKOnly + vbExclamation + vbApplicationModal Open "Ltrt.pws" For Output As #1 strPwd1 = InputBox(Msg1, Title1, Default, 100, 100) strPwd2 = InputBox(Msg2, Title1, Default, 100, 100) Write #1, strPwd1, strPwd2 Close #1 Open "Ltrt.pws" For Input As #1 Line Input #1, strData Close #1 If strPwd1 = strPwd2 Then Set PwdSv = strPwd2 Else Response = MsgBox(Msg3, Style, Title2) If Response.Value = 0 Then GoTo RESTART End If End Sub Public Sub Password() Dim Compare, PwdSv, Msg1, Msg2, Style, Title1, Title2 Msg1 = "Please Enter Your Password" Msg2 = "Password Incorrect" Set PwdSv = Worksheet("Sheet14").Range("C17").Value Style = vbOKOnly + vbExclamation + vbApplicationModal Title1 = "Password Required" Title2 = "Password Volilation" Retry: Compare = InputBox(Msg1, Title1, 100, 100) If PwdSv = Compare Then Call ScreenFieldUnlock Else Response = MsgBox(Msg2, Style, Title2) If Response.Value = 0 Then GoTo Retry End Sub Public Sub ScreenFieldUnlock() TextBox1.Locked = False TextBox2.Locked = False TextBox3.Locked = False TextBox4.Locked

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups