Good Afternoon,
I have created a userform that reads of one sheet and then updates another with the added info making the original info redundant.
I have a unique number for each enquiry raised but am having an issue adding a piece of code i have been given by a colleague at work.
I am trying to add the code to the submit button so that when it is saving it to the new sheet it also removes the old line.
It is taking info from "sheet1" and then adds it to a mangers name.
I have the following code that succesfully saves to the correct sheets as below, but need to add the following to remove the original line.
I have been supplied the following code to remove the line. The unique number is in "TextBox18" and in column "D" in "Sheet1"
</o>
<o></o>
<o>Hopefully someone can help me as i am wishing i had never taken the project on.</o>
<o></o>
<o>Many Thanks</o>
<o>Gavin</o>
I have created a userform that reads of one sheet and then updates another with the added info making the original info redundant.
I have a unique number for each enquiry raised but am having an issue adding a piece of code i have been given by a colleague at work.
I am trying to add the code to the submit button so that when it is saving it to the new sheet it also removes the old line.
It is taking info from "sheet1" and then adds it to a mangers name.
I have the following code that succesfully saves to the correct sheets as below, but need to add the following to remove the original line.
Rich (BB code):
Private Sub CommandButton3_Click()
'Checks if info in fields are missing
If Me.ComboBox4.Value = "" Then
MsgBox "You need to complete the customer name"
Else
If Me.TextBox17.Value = "" Then
MsgBox "You need to complete your question catogery"
Else
If Me.JEN.Value = "" Then
MsgBox "Can you confirm you have checked the How Guide"
Else
If Me.CBoxAdd.Value = "" Then
MsgBox "You need to complete your question"
Else
Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
'Opens file to
'Workbooks.Open Filename:="C:\Users\MAZZA\Documents\Gavin\Car Park\FYVData.xls" 'Home
Workbooks.Open Filename:="\\W2K6082\COMMON\SHARED\Gavin Mazza\Car Park\FYVData.xls"
Dim myBook As Workbook
On Error Resume Next
Set myBook = Application.Workbooks("FYVData.xls")
On Error GoTo 0
If myBook.ReadOnly Then
MsgBox "This file is being used by someone else please try again in a minute"
ActiveWorkbook.Close False
Else
'checks cmbcsm.value and save's to the sheet with that name in the workbook above
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets(CmbCSM.Value)
ws.AutoFilterMode = False
ws.Cells(ws.Rows.Count, "A").End(xlUp).Offset(1).Resize(, 19).Value = Array(txtdate.Value, _
TextBox18.Value, CmbCSM.Value, TextBox1.Value, TextBox2.Value, TextBox6.Value, TextBox5.Value, _
TextBox3.Value, TextBox4.Value, TextBox7.Value, TextBox8.Value, TextBox14.Value, TextBox15.Value, _
TextBox9.Value, JEN.Value, TextBox12.Value, ComboBox4.Value, TextBox17.Value, CBoxAdd.Value)
'clear the data
Me.txtdate.Value = ""
Me.CmbCSM.Value = ""
Me.TextBox1.Value = ""
Me.TextBox2.Value = ""
Me.TextBox6.Value = ""
Me.TextBox3.Value = ""
Me.TextBox5.Value = ""
Me.TextBox4.Value = ""
Me.TextBox7.Value = ""
Me.TextBox8.Value = ""
Me.TextBox14.Value = ""
Me.TextBox9.Value = ""
Me.JEN.Value = ""
Me.TextBox12.Value = ""
Me.ComboBox4.Value = ""
Me.TextBox17.Value = ""
Me.CBoxAdd.Value = ""
Windows("FYVData.xls").Activate
ActiveWindow.Close (True)
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
MsgBox "Your Car Park has been submitted"
Unload Me
End If
End If
End If
End If
End If
End Sub
I have been supplied the following code to remove the line. The unique number is in "TextBox18" and in column "D" in "Sheet1"
Rich (BB code):
Sheets("Audit").Activate<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
With ActiveSheet<o:p></o:p>
<o:p></o:p>
LastRow = .Cells(.Rows.Count, "AA").End(xlUp).Row<o:p></o:p>
For i = LastRow To 2 Step -1<o:p></o:p>
<o:p></o:p>
If .Cells(i, "AA").Value = 0 Then<o:p></o:p>
.Rows(i).Delete<o:p></o:p>
End If<o:p></o:p>
Next i<o:p></o:p>
<o:p></o:p>
End With<o:p></o:p>
<o:p></o:p>
With Application<o:p></o:p>
.Calculation = xlCalculationAutomatic<o:p></o:p>
<o:p>
<o></o>
<o>Hopefully someone can help me as i am wishing i had never taken the project on.</o>
<o></o>
<o>Many Thanks</o>
<o>Gavin</o>