![]() |
|
#1
|
|||
|
|||
|
I have a button on one of my sheets which, when clicked, creates a data input form containing fields. I enter data into the fields, hit submit, and a new record is created in my excel sheet. (so far, so good)
I would like to add to (improve) how my form works, but I cannot find where to edit the form's design. Can someone tell me where to find its code please. |
|
#2
|
|||
|
|||
|
How did you create the form ?
|
|
#3
|
|||
|
|||
|
A friend created it about 10 years ago, and I can't contact him. The form pops up when clicked, is colored, and some of the fields are pre-loaded so there must be code hidden somewhere.
Ive looked in "View Macros" and "Name Manager" but I can't see anything that I recognise, so Im wondering if there is somewhere else I should look?
|
|
#4
|
|||
|
|||
|
Right click the Sheet tab / View Code.
On the left you should see a list of properties. Chose FORMS (double click if the tree isn't already opened). Right click the form name / view code. |
|
#5
|
|||
|
|||
|
Ive found a short macro that looks like it might be related.
Code:
Sub OpenHarvestForm()
Application.WindowState = xlMinimized
frmHarvest.Show
Application.WindowState = xlMaximized
ActiveWorkbook.Sheets("GrpRecords").Activate
End Sub
But where would I find it? |
|
#6
|
|||
|
|||
|
Code:
Sub OpenHarvestForm() '<-- sub name
Application.WindowState = xlMinimized '<-- minimzes the entire excel workbook
frmHarvest.Show '<-- makes userform visible
Application.WindowState = xlMaximized '<-- makes excel workbook full sized
ActiveWorkbook.Sheets("GrpRecords").Activate
'^^^^ "Activate" prepares sheet GrpRecords for receiving actions such as writing data to it
End Sub
When the VBA editor window opens you want to right click on the icon FORM (see arrow) Then View Code. https://www.amazon.com/clouddrive/sh...hare_link_copy The code displayed in the large window changes how the various controls on the form function. If you just view the form itself (so it shows in the right hand window) you can edit the controls, labels and positioning of each. |
|
#7
|
|||
|
|||
|
Thank you for your help so far.
I have got into it successfully, and altered the values from ...Code:
Private Sub ClearFormbutton_Click()
Range("Calcs!AC11").Value = ""
Range("Calcs!AC12").Value = ""
Range("Calcs!AC13").Value = ""
Range("Calcs!AC14").Value = ""
Range("Calcs!AC15").Value = ""
Range("Calcs!AC16").Value = ""
Code:
Private Sub ClearFormbutton_Click()
Range("Calcs!U11").Value = ""
Range("Calcs!U12").Value = ""
Range("Calcs!U13").Value = ""
Range("Calcs!U14").Value = ""
Range("Calcs!U15").Value = ""
Range("Calcs!U16").Value = ""
|
|
#8
|
|||
|
|||
|
Very difficult to provide an accurate answer without having the entire workbook to review.
For additional assistance please post your project as an attachment so it can be downloaded. Remove any confidential information. |
|
#9
|
|||
|
|||
|
Quote:
and will need to take you up on your kind offer. Attached is Fish.xlsmMy problem pertains to the form (frmHarvest) activated from a button in G1 in the sheet, 'GrpRecords' . It creates an error in the sheet 'Calcs' by pasting data in the cells, 'AC11 to AC16' instead of 'U11 to U16'. Also, the drop down menus in the form should display choices but they are empty. I hope this is not too much bother to you. |
|
#10
|
||||
|
||||
|
Here are a few things I've reviewed and have questions about. These questions
are not an attempt to be critical ... just need to have a better understanding of where you were/are going with these items: Quote:
Quote:
Quote:
Quote:
Initially, I had alot of troubles trying to get the workbook to just load. Not certain why. It seems to at least load ok now and I'm able to edit and review. Hopefully that will continue. |
|
#11
|
|||
|
|||
|
It appears to me the Order sheet column B has pretty much the same stuff.
Not knowing how you use the file have to wonder if the userform shouldn't be writing to there. Your Auto_Open sub populates AC11:AC16 from U11:U16 Removed the ControlSource and RowSource from the text/combo box properties Set default property of Submit button to false Populate Country combo at Userform_Initialize Populate State combo from County_Change Submit button writes to next row on GrpRecords sheet, same as previous, now also writes to Calcs U11:U16 Don't think anything else changed |
|
#12
|
|||
|
|||
|
Quote:
working well now. I get lost with 'initializing' and the such.
|
|
#13
|
|||
|
|||
|
Quote:
Quote:
Quote:
|
|
#14
|
|||
|
|||
|
Ok .. looks good. Thanks for the answers - helps me better understand the intent.
The Denomination had me confused ... when looking at the Sheet information there are traditional denoms and also 'books', etc. Wasn't certain which direction it was supposed to go. Now I understand 'traditional denom'. My personal preference would be to have the Calcs sheet hidden at all times to minimize the possibility of someone editing the data. Could mess things up otherwise. Do you have any other questions we can assist with ? |
|
#15
|
|||
|
|||
|
Quote:
) However, there is a fair chance Ill be back with questions.Thanks for all the help so far. |
|
| Tags |
| input boxes |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automatically copy/paste a form field onto new pages, with user input included | Pindar | Word VBA | 3 | 01-13-2017 11:49 AM |
How to set font size in text-input field of protected form
|
UnicornVestibule | Word | 5 | 06-06-2016 10:51 PM |
| My First Attempt at Form Creation: Input of Text via Check Box or Radio Button | tatihulot | Excel | 0 | 08-15-2013 06:11 AM |
Word only writes top half of input in form
|
Chippychap | Word | 8 | 07-20-2012 12:49 AM |
Data input in Powerpoint?
|
DeeDubb | PowerPoint | 1 | 04-05-2012 01:53 AM |