Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable in a textbox reference?
is it possible to put a variable in a reference to a textbox? here is
my code: For i = 1 To loads Cells(8 + i, 3).Value = TextBoxPi.Value * 1.6 Next i I have textboxes labeled TextBoxP1, TextBoxP2, etc. and I want to get there values into worksheet cells only for a certain number (loads) of textboxes. so I'm trying to increment it by i. I assume my code will not work, but I'm wondering how this can be done. Thanks. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable in a textbox reference?
These are textboxes in a userform?
if yes: Option Explicit Private Sub CommandButton1_Click() Dim loads As Long Dim i As Long loads = 3 For i = 1 To loads Worksheets("sheet1").Cells(8 + i, 3).Value _ = Me.Controls("TextBoxP" & i).Value * 1.6 Next i End Sub Jacob wrote: is it possible to put a variable in a reference to a textbox? here is my code: For i = 1 To loads Cells(8 + i, 3).Value = TextBoxPi.Value * 1.6 Next i I have textboxes labeled TextBoxP1, TextBoxP2, etc. and I want to get there values into worksheet cells only for a certain number (loads) of textboxes. so I'm trying to increment it by i. I assume my code will not work, but I'm wondering how this can be done. Thanks. -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable in a textbox reference?
that's what i needed. Thank you!
Dave Peterson wrote: These are textboxes in a userform? if yes: Option Explicit Private Sub CommandButton1_Click() Dim loads As Long Dim i As Long loads = 3 For i = 1 To loads Worksheets("sheet1").Cells(8 + i, 3).Value _ = Me.Controls("TextBoxP" & i).Value * 1.6 Next i End Sub Jacob wrote: is it possible to put a variable in a reference to a textbox? here is my code: For i = 1 To loads Cells(8 + i, 3).Value = TextBoxPi.Value * 1.6 Next i I have textboxes labeled TextBoxP1, TextBoxP2, etc. and I want to get there values into worksheet cells only for a certain number (loads) of textboxes. so I'm trying to increment it by i. I assume my code will not work, but I'm wondering how this can be done. Thanks. -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I reference a textbox in a formula in Excel | Excel Worksheet Functions | |||
Validating a unique reference in a textbox | Excel Programming | |||
How to copy text from a TextBox in a ActiveSheet to a variable | Excel Programming | |||
How to copy text from a TextBox in a ActiveSheet to a variable | Excel Programming | |||
Variable TextBox | Excel Programming |