I have a userform that enters discontinued items into a log on "sheet 1"
I have a checkbox, that I need to work like this: If checkbox is checked, then the form needs to find the data matching txtItemNum (Item Number Field) in column 1, then delete only the first 9 cells in the row, then shift cells up. Here is my form.
Attachment 385088
Here is my code it goes into. It needs to be at the bottom where I have entered the checkbox IF statement.
Private Sub buttonDiscontinue_Click()
Dim ssheet As Worksheet
Set ssheet = Worksheets("DISC Item Log")
Dim row As Long
Dim rsheet As Worksheet
Set rsheet = Worksheet("Product Reference Guide")
'Prompt message Box to confirm
If MsgBox("You are about to Discontinue:" & vbCr & vbCr & _
" Item # : " & txtItemNum.Value & vbCr & _
"Description : " & txtItemDescription.Value & vbCr & vbCr & _
"Is this correct?", vbYesNo, "") = vbNo Then Exit Sub
Application.ScreenUpdating = True
'find first empty row in database
row = ssheet.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).row
'fill cells with values and apply borders
ssheet.Cells(row, 1).Value = txtItemDescription
With ssheet.Cells(row, 1).Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 1).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 1).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 1).Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
ssheet.Cells(row, 2).Value = txtItemNum
With ssheet.Cells(row, 2).Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 2).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 2).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 2).Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
ssheet.Cells(row, 3).Value = txtDate
With ssheet.Cells(row, 3).Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 3).Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 3).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 3).Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 3).Borders(xlInsideVertical)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With ssheet.Cells(row, 3).Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
'remove item from product reference book
If chkBrand = True Then
End Sub
Bookmarks