hello,
i am working on a spreadsheet for work and one of the tasks I'm trying to accomplish is when i fillout a cell in the "Part #" column(B) to auto fill the equivalent cell in the "CUST #" Column(m) with the number 808849. i have this working except it over rights my header row(row 7) because the label "PART #" means that cell is filled so it overrights "CUST #". i have tried to limit the range to row 8+ but it then freaks out and dumps 808849 into a bunch of random fields. in the attached file i had to sanitize it due to confidentiality. if it would help i can fill it back up with fake info. i know everyone says this but i am pretty new to VBA scripting so i'm sure I'm missing something very obvious, also i know this script is a bit useless by itself but it's only step one to a much larger intent.
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim RNG As Range
'Dim ws As Worksheet
'Set ws = Worksheets("Sheet1")
'Dim lastRow As Long
Application.EnableEvents = False
On Error Resume Next
'lastRow = ws.Cells(ws.Rows.Count, "B").End(xlUp).Row
'MsgBox (lastRow)
Set RNG = Range("B:B").SpecialCells(xlConstants)
If Not RNG Is Nothing Then
RNG.Offset(, 11) = "808849"
Else
Cells.ClearContents
End If
Application.EnableEvents = True
End Sub
Blank_template.xlsm
Bookmarks