I am using the below VB to populate the info filled on my userform to find the line the info was from then fill in the last 4 columns
The code has been working previously but the info is now stored on 1 of 3 sheets in my workbook. "Ashley Longman" This is checked to find the right name. It finds the correct link and then puts it 1 row underneath in the correct columns. How can i re align this correctley?
Many Thanks
The code has been working previously but the info is now stored on 1 of 3 sheets in my workbook. "Ashley Longman" This is checked to find the right name. It finds the correct link and then puts it 1 row underneath in the correct columns. How can i re align this correctley?
Rich (BB code):
Dim iRow As Long
Dim ws As Worksheet
If Me.JEN.Value = "" Then ' Check before submit
MsgBox "Please Complete is this a justified Enquiry"
Else
If Me.AComm.Value = "" Then ' Check before submit
MsgBox "Please Leave Your Comments"
Else
If Me.CBoxAdd.Value = "" Then ' Check before submit
MsgBox "Please Enter Your Name"
Else
'Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\Data.xls" Home
Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Gavin Mazza\Car Park\Data.xls"
If UserForm1.TextBox13 = "Ashley Longman" Then 'Info location
ActiveWorkbook.Sheets("Ashley Longman").Activate
Unload Me
Set ws = Worksheets("Ashley Longman")
iRow = ws.Cells(Rows.Count, 11) _
.End(xlUp).Offset(1, 0).Row
'copy the data to the database
ws.Cells(iRow, 12).Value = Me.JEN.Value
ws.Cells(iRow, 14).Value = Me.AComm.Value
ws.Cells(iRow, 15).Value = Me.CBoxAdd.Value
ws.Cells(iRow, 13).Value = Me.TextBox12
'clear the data
Me.JEN.Value = ""
Me.AComm.Value = ""
Me.CBoxAdd.Value = ""
Me.TextBox12.Value = ""
Me.txtdate.Enabled = True
Workbooks("Data.xls").Close True
End If
End If
End If
End If
Many Thanks