Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Deleting/Adding/Changing values based on ComboBox1 Value

On a userform I have combobox1, Textbox1, Textbox2, and
Textbox3 and commandbutton1. The values of the 3
textboxes depend on the value of combobox1. Values of
combobox1 are pulled from range M2:M100. The user will
select a value from the combobox. When he/she selects a
value from the combobox, the textboxes will populate with
corresponding values from 3 different ranges. Textbox1
pulls in data from range P2:P100. Textbox2 pulls in data
from range Q2:Q100. Textbox3 pulls in data from range
R2:R100.

The user can then add/change/delete values in the 3
textboxes. When the user makes the desired changes,
he/she hits the Update commandbutton1. I need a code that
will make the changes to the appropriate corresponding
cell in the corresponding range that the textbox
references.


Thank you

Todd
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default Deleting/Adding/Changing values based on ComboBox1 Value

How are the textboxes populated to begin with?

Assuming that they're based on something like the Combobox ListIndex:

CommandButton1_Click()
Dim nIndex As Long
nIndex = ComboBox1.ListIndex
With ThisWorkbook.Sheets("MyDataSheet")
.Range("P2").Offset(nIndex, 0).Value = TextBox1.Value
.Range("Q2").Offset(nIndex, 0).Value = TextBox2.Value
.Range("R2").Offset(nIndex, 0).Value = TextBox3.Value
End With
'Other Stuff - e.g. Unload, Hide
End Sub

In article ,
"Todd Huttenstine" wrote:

On a userform I have combobox1, Textbox1, Textbox2, and
Textbox3 and commandbutton1. The values of the 3
textboxes depend on the value of combobox1. Values of
combobox1 are pulled from range M2:M100. The user will
select a value from the combobox. When he/she selects a
value from the combobox, the textboxes will populate with
corresponding values from 3 different ranges. Textbox1
pulls in data from range P2:P100. Textbox2 pulls in data
from range Q2:Q100. Textbox3 pulls in data from range
R2:R100.

The user can then add/change/delete values in the 3
textboxes. When the user makes the desired changes,
he/she hits the Update commandbutton1. I need a code that
will make the changes to the appropriate corresponding
cell in the corresponding range that the textbox
references.


Thank you

Todd

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Deleting/Adding/Changing values based on ComboBox1 Value

Here is how I have it all linked.

With Worksheets(4)
Set rng = .Range("M2:M100")
For Each cell In rng
If cell.Text = ComboBox1.Value Then
TextBox1.Value = .Cells(cell.Row, 16).Value
TextBox2.Value = .Cells(cell.Row, 17).Value
TextBox3.Value = .Cells(cell.Row, 18).Value
Exit For
End If
Next
End With


-----Original Message-----
How are the textboxes populated to begin with?

Assuming that they're based on something like the

Combobox ListIndex:

CommandButton1_Click()
Dim nIndex As Long
nIndex = ComboBox1.ListIndex
With ThisWorkbook.Sheets("MyDataSheet")
.Range("P2").Offset(nIndex, 0).Value =

TextBox1.Value
.Range("Q2").Offset(nIndex, 0).Value =

TextBox2.Value
.Range("R2").Offset(nIndex, 0).Value =

TextBox3.Value
End With
'Other Stuff - e.g. Unload, Hide
End Sub

In article ,
"Todd Huttenstine"

wrote:

On a userform I have combobox1, Textbox1, Textbox2, and
Textbox3 and commandbutton1. The values of the 3
textboxes depend on the value of combobox1. Values of
combobox1 are pulled from range M2:M100. The user will
select a value from the combobox. When he/she selects

a
value from the combobox, the textboxes will populate

with
corresponding values from 3 different ranges. Textbox1
pulls in data from range P2:P100. Textbox2 pulls in

data
from range Q2:Q100. Textbox3 pulls in data from range
R2:R100.

The user can then add/change/delete values in the 3
textboxes. When the user makes the desired changes,
he/she hits the Update commandbutton1. I need a code

that
will make the changes to the appropriate corresponding
cell in the corresponding range that the textbox
references.


Thank you

Todd

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Deleting/Adding/Changing values based on ComboBox1 Value

Todd,

Just reverse it?

..Cells(cell.Row, 16).Value = TextBox1.Value

Regards,
Anders Silven


"Todd" skrev i meddelandet ...
Here is how I have it all linked.

With Worksheets(4)
Set rng = .Range("M2:M100")
For Each cell In rng
If cell.Text = ComboBox1.Value Then
TextBox1.Value = .Cells(cell.Row, 16).Value
TextBox2.Value = .Cells(cell.Row, 17).Value
TextBox3.Value = .Cells(cell.Row, 18).Value
Exit For
End If
Next
End With


-----Original Message-----
How are the textboxes populated to begin with?

Assuming that they're based on something like the

Combobox ListIndex:

CommandButton1_Click()
Dim nIndex As Long
nIndex = ComboBox1.ListIndex
With ThisWorkbook.Sheets("MyDataSheet")
.Range("P2").Offset(nIndex, 0).Value =

TextBox1.Value
.Range("Q2").Offset(nIndex, 0).Value =

TextBox2.Value
.Range("R2").Offset(nIndex, 0).Value =

TextBox3.Value
End With
'Other Stuff - e.g. Unload, Hide
End Sub

In article ,
"Todd Huttenstine"

wrote:

On a userform I have combobox1, Textbox1, Textbox2, and
Textbox3 and commandbutton1. The values of the 3
textboxes depend on the value of combobox1. Values of
combobox1 are pulled from range M2:M100. The user will
select a value from the combobox. When he/she selects

a
value from the combobox, the textboxes will populate

with
corresponding values from 3 different ranges. Textbox1
pulls in data from range P2:P100. Textbox2 pulls in

data
from range Q2:Q100. Textbox3 pulls in data from range
R2:R100.

The user can then add/change/delete values in the 3
textboxes. When the user makes the desired changes,
he/she hits the Update commandbutton1. I need a code

that
will make the changes to the appropriate corresponding
cell in the corresponding range that the textbox
references.


Thank you

Todd

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default Deleting/Adding/Changing values based on ComboBox1 Value

Thank you.

Thats exactly what I needed.

Todd
-----Original Message-----
How are the textboxes populated to begin with?

Assuming that they're based on something like the

Combobox ListIndex:

CommandButton1_Click()
Dim nIndex As Long
nIndex = ComboBox1.ListIndex
With ThisWorkbook.Sheets("MyDataSheet")
.Range("P2").Offset(nIndex, 0).Value =

TextBox1.Value
.Range("Q2").Offset(nIndex, 0).Value =

TextBox2.Value
.Range("R2").Offset(nIndex, 0).Value =

TextBox3.Value
End With
'Other Stuff - e.g. Unload, Hide
End Sub

In article ,
"Todd Huttenstine"

wrote:

On a userform I have combobox1, Textbox1, Textbox2, and
Textbox3 and commandbutton1. The values of the 3
textboxes depend on the value of combobox1. Values of
combobox1 are pulled from range M2:M100. The user will
select a value from the combobox. When he/she selects

a
value from the combobox, the textboxes will populate

with
corresponding values from 3 different ranges. Textbox1
pulls in data from range P2:P100. Textbox2 pulls in

data
from range Q2:Q100. Textbox3 pulls in data from range
R2:R100.

The user can then add/change/delete values in the 3
textboxes. When the user makes the desired changes,
he/she hits the Update commandbutton1. I need a code

that
will make the changes to the appropriate corresponding
cell in the corresponding range that the textbox
references.


Thank you

Todd

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting rows based on column values Dazed and Confused[_2_] New Users to Excel 3 February 6th 09 10:47 PM
Deleting rows based on values in a a cell in the row Martin New Users to Excel 1 January 25th 09 11:46 AM
Adding up various columns based on the value of one changing cell Darrilyn Excel Worksheet Functions 4 September 6th 07 06:56 PM
Adding numerical values based on multiple values in another column Kazmaniac Excel Worksheet Functions 6 April 4th 07 08:53 PM
3 textbox values based on value in ComboBox1 Todd Huttenstine[_2_] Excel Programming 2 November 10th 03 02:19 AM


All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"