Hi,
I am trying to enter the Data from my userform in Excel 2007 to a range of cells. The Range is from A8:M51. I can use this formula below to add the Data but it puts it into Row 60??? This Range is enclosed around other cells with data, so I am not sure if that is why it starts at Row 60? I also need this to clear and have the next data entered into the row below. So Row "A8" should be the first row of Data and when I click on the button to add Data, the userform will clear and I can enter new Data and it would be inserted on Row "A9" when the Add Data button is clicked again.
Private Sub CommandButton_AddData2_Click()
Dim RowCount As Long
RowCount = Worksheets("WorkSheet-1").Range("A7").CurrentRegion.Rows.Count
With Worksheets("WorkSheet-1").Range("A7")
.Offset(RowCount, 0) = Me.ComboBox_Isolationtype.Value
.Offset(RowCount, 3) = Me.TextBox_Material.Value
.Offset(RowCount, 4) = Me.TextBox_IsolationLocation.Value
.Offset(RowCount, 7) = Me.ComboBox_Valveposition.Value
.Offset(RowCount, 8) = Me.ComboBox_Type.Value
.Offset(RowCount, 11) = Me.ComboBox_LineSize.Value
.Offset(RowCount, 12) = Me.ComboBox_Pressure.Value
End With
MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
Me.ComboBox_Isotype.Value = ""
Me.TextBox_Material.Value = ""
Me.TextBox_Isolocal.Value = ""
Me.ComboBox_Valveposition.Value = ""
Me.ComboBox_Type.Value = ""
Me.ComboBox_Isotype.SetFocus
End Sub
Thanks in Advance
Bookmarks