Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Need Help In visual basic!


  • Please log in to reply

#1
Ryan_esx7

Ryan_esx7

    Member

  • Member
  • PipPip
  • 17 posts
[size=4][font=Times New Roman]
Hi
i need help
in the visual basic you get with windows office professional 2003
i have created a spreadsheet (excel project) i have many user forms
i would like one user form to take me to another and i would like on button on there to be hidden when it appears, how do i do this??

Awaiting help
Thanx in advance!
  • 0

Advertisements


#2
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,030 posts
  • MVP
you can set the visibility property on that button to be off untill a certain action happens...

generally under the option expllicit portion of the code on that form you would do something like

cmd1.hide


then say....if they have this checkbox checked the allow the button

if chck1 = yes then cmd1.show


my syntax is probably horribly wrong...but...this is the general idea

i
  • 0

#3
Ryan_esx7

Ryan_esx7

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
Hey, thanx for your reply

Got more info on the problem, i want to click a button on one user form, it takes me to another but i have 4 buttons on that userform and i only want 3 to be displayed!

i have tried lots of editing the code on the bit for the 'actual first button' i click, but i cannot seem to get that button to go away when the next user from appears

HELP!!
  • 0

#4
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,030 posts
  • MVP
why do you have 4 buttons if you only need 3?
  • 0

#5
Ryan_esx7

Ryan_esx7

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
here is a better description of the problem, with print-screens to help explain it!!

hope someone knows

LOL

Ryan

Attached Thumbnails

  • Spreadsheet_help_2.JPG

  • 0

#6
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,030 posts
  • MVP
ok gotcha...


you need to have the final confirm button set to invisible by default....usually when the page loads

so up at the top you would do finalconfirm.cmd.hide

then in the code for the confirm button... put finalconfirm.cmd.show...that way that button is invisble untill you press the confirm button
  • 0

#7
Ryan_esx7

Ryan_esx7

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
thanx but it didn't work
here was the error it gave me

Attached Thumbnails

  • 2nd_help.JPG

  • 0

#8
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,030 posts
  • MVP
don't put it on the button for new customer that form has no idea what button you're talking about

you need to put taht at the top of the code for the second form...underneath the option explicit..
  • 0

#9
Ryan_esx7

Ryan_esx7

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
hi soz to be an idiot

but i'm new at this, could u take me through it step by step?

Thanks for you patience

Ryan
  • 0

#10
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,030 posts
  • MVP
could you copy and paste the code from the second form into y our next post...i'll point out where to put the stuff
  • 0

Advertisements


#11
Ryan_esx7

Ryan_esx7

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
Private Sub Cancel_Button_Click()

UserForm_New_Customer.Hide
UserForm_Customer.Show

End Sub

Private Sub Clear_button_Click()
UserForm_New_Customer("TextBox_Surname").Text = ""
UserForm_New_Customer("TextBox_Forename").Text = ""
UserForm_New_Customer("TextBox_Address1").Text = ""
UserForm_New_Customer("TextBox_Address2").Text = ""
UserForm_New_Customer("TextBox_PostCode").Text = ""
UserForm_New_Customer("TextBox_City").Text = ""
UserForm_New_Customer("TextBox_Telephone").Text = ""


End Sub

Private Sub CommandButton1_Click()

End Sub

Private Sub Confirm_button_Click()

Final_Confirm_Button2.Hide

Sheets("Customer ID's").Select

Sheets("Customer ID's").Select
Rows("4:4").Select
Selection.Insert Shift:=xlDown

Range("A5").Select
ActiveCell.FormulaR1C1 = "=R[1]C+1"
Comment1 = "Your customer identity number is "
TextBox_ID = Comment1 & Range("A5").Value


Range("B5").Value = TextBox_Forename.Text
Range("C5").Value = TextBox_Surname.Text
Range("D5").Value = TextBox_address1.Text
Range("E5").Value = TextBox_address2.Text
Range("F5").Value = TextBox_City.Text
Range("G5").Value = TextBox_PostCode.Text
Range("H5").Value = TextBox_Telephone.Text


UserForm_New_Customer("TextBox_Forename").Text = ""
UserForm_New_Customer("TextBox_Surname").Text = ""
UserForm_New_Customer("TextBox_address1").Text = ""
UserForm_New_Customer("TextBox_address2").Text = ""
UserForm_New_Customer("TextBox_City").Text = ""
UserForm_New_Customer("TextBox_PostCode").Text = ""
UserForm_New_Customer("TextBox_Telephone").Text = ""

Confirm_button.Visible = False
Cancel_Button.Visible = False
Clear_button.Visible = False
Final_Confirm_Button2.Visible = True

Sheets("Thank you").Select



End Sub



this is all the code from the second user form

Thanks
  • 0

#12
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,030 posts
  • MVP
option explicit
Final_Confirm_Button2.Visible = false

Private Sub Cancel_Button_Click()

UserForm_New_Customer.Hide
UserForm_Customer.Show

End Sub

Private Sub Clear_button_Click()
UserForm_New_Customer("TextBox_Surname").Text = ""
UserForm_New_Customer("TextBox_Forename").Text = ""
UserForm_New_Customer("TextBox_Address1").Text = ""
UserForm_New_Customer("TextBox_Address2").Text = ""
UserForm_New_Customer("TextBox_PostCode").Text = ""
UserForm_New_Customer("TextBox_City").Text = ""
UserForm_New_Customer("TextBox_Telephone").Text = ""


End Sub

Private Sub CommandButton1_Click()

End Sub

Private Sub Confirm_button_Click()


Sheets("Customer ID's").Select

Sheets("Customer ID's").Select
Rows("4:4").Select
Selection.Insert Shift:=xlDown

Range("A5").Select
ActiveCell.FormulaR1C1 = "=R[1]C+1"
Comment1 = "Your customer identity number is "
TextBox_ID = Comment1 & Range("A5").Value


Range("B5").Value = TextBox_Forename.Text
Range("C5").Value = TextBox_Surname.Text
Range("D5").Value = TextBox_address1.Text
Range("E5").Value = TextBox_address2.Text
Range("F5").Value = TextBox_City.Text
Range("G5").Value = TextBox_PostCode.Text
Range("H5").Value = TextBox_Telephone.Text


UserForm_New_Customer("TextBox_Forename").Text = ""
UserForm_New_Customer("TextBox_Surname").Text = ""
UserForm_New_Customer("TextBox_address1").Text = ""
UserForm_New_Customer("TextBox_address2").Text = ""
UserForm_New_Customer("TextBox_City").Text = ""
UserForm_New_Customer("TextBox_PostCode").Text = ""
UserForm_New_Customer("TextBox_Telephone").Text = ""

Confirm_button.Visible = False
Cancel_Button.Visible = False
Clear_button.Visible = False
Final_Confirm_Button2.Visible = True

Sheets("Thank you").Select



End Sub



you had it pretty close
  • 0

#13
Ryan_esx7

Ryan_esx7

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
Hi, just got to the point of wanting to put my fist through the screen

it doesn't want to let me put it where i need to.

u want a look!

Ryan

Attached Files


  • 0

#14
dsenette

dsenette

    Je suis Napoléon!

  • Administrator
  • 26,030 posts
  • MVP
here ya go.....
what i did was change the properties on the final confirm button to default to invisble...then basically left your code how it was...i believe i removed the formclick..thing aat the end..
  • 0

#15
Ryan_esx7

Ryan_esx7

    Member

  • Topic Starter
  • Member
  • PipPip
  • 17 posts
hey, thanks very much

u've helped me at my A-Levels, and saved my screen from a rather big hole in the middle.

Thank you very much, u are very very clever, and you certainly know what ur doing.

Thank you once again

Ryan

P.S. if i have any more probs, you know i'm coming to you now, lol

Thanx again
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP