What exactly is happening? I didn't have your file to test it. I'm sure you can figure out what's going wrong where, since it's pretty straight forward...
Printable View
What exactly is happening? I didn't have your file to test it. I'm sure you can figure out what's going wrong where, since it's pretty straight forward...
It updates the the 6 cells in 1 column 6 rows instead of updating the 6 cells in 1 row and 6 columns. See Attachment 595
Try this then
Code:.Cells(Rx1, 3).Resize(,6).Value = var
Great works FAST :D
Last question... what do i need to change when working with multitabs and multiple listboxes. I tried to use the code below.
Code:Private Sub CommandButton2_Click()
Dim var(3 To 8) As String
Dim j As Long
Dim x As Long
If Me.ListBox2.ListIndex = -1 Then
MsgBox "No Data Selected"
Exit Sub
End If
If Me.TextBox2.Value = "" Then Exit Sub
Rx2 = Rx2 + Me.ListBox1.ListIndex 'row index
With Sheets("INPUT BS LISTBOX")
For j = 3 To 8
var(j) = Me.Controls("TextBox" & j + 8).Text 'Starts in Textbox 9
Next j
.Cells(Rx2, 3).Resize(, 6).Value = var
End With
Call UserForm_Initialize
End Sub
Got a question about the code i used couple of days. When i typed for example 3 in my textbox and i pushed on update it showed automatically 3% but with the new code it does not take over the cell property's :( how can.
OLD CODE (fills cell format e.g. 3 will be automatically 3%)
NEW CODE FAST (but puts only the value in the box e.g. 3 stays 3.)Code:Private Sub CommandButton2_Click()
Dim j As Long
Dim x As Long
If Me.ListBox1.ListIndex = -1 Then
MsgBox "No Data Selected"
Exit Sub
End If
If Me.TextBox1.Value = "" Then Exit Sub
Rx1 = Rx1 + Me.ListBox1.ListIndex
With Sheets("INPUT WV LISTBOX")
For j = 8 To 10
.Cells(Rx1, j).Value = Me.Controls("TextBox" & j - 3).Text
Next j
End With
Call UserForm_Initialize
End Sub
Code:rivate Sub CommandButton2_Click()
Dim var(3 To 8) As String
Dim j As Long
Dim x As Long
If Me.ListBox1.ListIndex = -1 Then
MsgBox "No Data Selected"
Exit Sub
End If
If Me.TextBox1.Value = "" Then Exit Sub
Rx1 = Rx1 + Me.ListBox1.ListIndex
With Sheets("INPUT WV LISTBOX")
For j = 3 To 8
var(j) = Me.Controls("TextBox" & j).Text
Next j
.Cells(Rx1, 3).Resize(, 6).Value = var
End With
Call UserForm_Initialize
End Sub
tryCode:.Cells(Rx1, 3).Resize(, 6).Formula = var
Just tested but not working :(
Why don't you post a sample workbook ???
See Attachment 599
When i useit works but then the data wil be placed in 1 columnCode:.Cells(Rx1, 3).Resize(6).Value = Application.Transpose(var)
When i useit places the content in 6 column on 1 row what i need but then the cell propertys will not be used :confused:Code:.Cells(Rx1, 3).Resize(, 6).Value = var
Solved the problem using:) one small change...but don't know why that function application.transpose does the trick. :confused:Code:.Cells(Rx1, 3).Resize(, 6).Value = Application.Transpose(var)