Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all, i have an input Form that has 86 textBoxes in it and just wanted
to know which is the best method to put the input into the desired cells on the worksheet. Is it better to make the textbox value a variable and then insert it into the desired cell or is it better to link the inputbox to the desired cell, so the input goes straight into the cell as it is typed into the textbox ? Tempy *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Depends how much work and how variable it is.
Linking is binding it, and takes a lot of effort for 86 textboxes, and is inflexible with so many. You could do it in a loop Dim oCtl As Control Dim i As Long For Each oCtl In Me.Controls If TypeOf oCtl Is msforms.TextBox Then i = i + 1 ActiveSheet.Cells(i, "A").Value = oCtl.Text End If Next oCtl -- HTH Bob Phillips "Tempy" wrote in message ... Hi all, i have an input Form that has 86 textBoxes in it and just wanted to know which is the best method to put the input into the desired cells on the worksheet. Is it better to make the textbox value a variable and then insert it into the desired cell or is it better to link the inputbox to the desired cell, so the input goes straight into the cell as it is typed into the textbox ? Tempy *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot Bob,
Please excuse the ignorance, but could you explain abit more how the loop would work, as it has to place the values in different celss all over the worksheet. thanks, Tempy *** Sent via Developersdex http://www.developersdex.com *** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Tempy,
It simply goes through all the controls on the from and tests whether it is a textbox or not. If so, it drops the value into a cell. Perhaps you could name the textbox as the cell address, such as txtA1,txtM25, etc, then use Dim oCtl As Control Dim i As Long For Each oCtl In Me.Controls If TypeOf oCtl Is msforms.TextBox Then i = i + 1 ActiveSheet.Range(Right(oCtl.Name, _ Len(oCtl.Name) - 3)).Value = oCtl.Text End If Next oCtl This extracts that cell address from the textbox name and saves the value in that cell. Any good? -- HTH Bob Phillips "Tempy" wrote in message ... Thanks a lot Bob, Please excuse the ignorance, but could you explain abit more how the loop would work, as it has to place the values in different celss all over the worksheet. thanks, Tempy *** Sent via Developersdex http://www.developersdex.com *** |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() IMHO, it's better to not link the cells, as this gives you the opportunity to validate the input before it hits the spreadsheet. You don't need to have an intermediate variable, you just use the textbox object text property. On another slant, an input form with 86 input fields can be a bit daunting to the user. Have you thought about grouping your input fields and then placing them on Tabs so that the user clicks a general heading and then gets the text boxes that are relevant to that heading ?? For example you could group the fields (assuming you're doing a sales order for instance) as: General Delivery Items And the general tab would contain the Account number, Po Number, Po Date and Billing details. The Delivery tab would contain the delivery instructions, and the items tab the individual items. Regards Rich -- Rich_z ------------------------------------------------------------------------ Rich_z's Profile: http://www.excelforum.com/member.php...o&userid=24737 View this thread: http://www.excelforum.com/showthread...hreadid=394509 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks for the suggestion Rich, i think i might just go that way, as i
have 4 different groups. Thanks for the help, much appreciated. Tempy *** Sent via Developersdex http://www.developersdex.com *** |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
input in number form is being multiplied by 1000 when i input. | Excel Discussion (Misc queries) | |||
Real Newbie newbie question | New Users to Excel | |||
How can I have an input form to add a random no. to each input entry? | Excel Discussion (Misc queries) | |||
Input form question | Excel Programming | |||
A newbie question Forms - Input and Output from an Excel Worksheet | Excel Programming |