white_flag
01-15-2012, 05:46 AM
hello
I have an excel file that will update via an user form, some fileds in the same excel file. this is the code
Private Sub CommandButton114_Click()
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Worksheets("company")
With ws
LastRow = .Sheets(1).Cells.Find(What:="*", After:=[a1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
.Sheets(2).Range("A2", Cells(LastRow, "A").Address).Value = ComboBox13.Value
.Sheets(2).Range("B2", Cells(LastRow, "B").Address).Value = TextBox11.Text
.Sheets(2).Range("C2", Cells(LastRow, "C").Address).Value = TextBox12.Text
End With
End Sub
how can be done this in a diffrent excel file (ex. companys.xls) not in this? Thank you
ps.sorry I put this in word forum. can be moved in excel forum.thx
I have an excel file that will update via an user form, some fileds in the same excel file. this is the code
Private Sub CommandButton114_Click()
Dim LastRow As Long
Dim ws As Worksheet
Set ws = Worksheets("company")
With ws
LastRow = .Sheets(1).Cells.Find(What:="*", After:=[a1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
.Sheets(2).Range("A2", Cells(LastRow, "A").Address).Value = ComboBox13.Value
.Sheets(2).Range("B2", Cells(LastRow, "B").Address).Value = TextBox11.Text
.Sheets(2).Range("C2", Cells(LastRow, "C").Address).Value = TextBox12.Text
End With
End Sub
how can be done this in a diffrent excel file (ex. companys.xls) not in this? Thank you
ps.sorry I put this in word forum. can be moved in excel forum.thx