Howdy,
I have used this code before for other sheets in my workbook. I changed the name to be the new worksheet and adjusted the code throughout my workbook to include the new worksheet.
I get the Compile Error: Variable Not Defined when ever I point to the Set wsIBMass (new worksheet). I am not sure what I am missing.
I have used this code before for other sheets in my workbook. I changed the name to be the new worksheet and adjusted the code throughout my workbook to include the new worksheet.
I get the Compile Error: Variable Not Defined when ever I point to the Set wsIBMass (new worksheet). I am not sure what I am missing.
Code:
Option Explicit
'Created on 11/27/17; Copy of information from MDS Equipment Detail Sheet to the IB Mass Creation Sheet
Sub BuildIBMass()
Dim i As Long
Dim iCol As Long
Set wsMDS = Worksheets("MDS Equipment Detail")
Set wsIBMass = Worksheets("IB Mass Creation")
Set headerMDS = wsMDS.Rows(rowHeaderMDS)
Set headerIBMass = wsMOST.Rows(rowHeaderIBMass)
Application.ScreenUpdating = False
'get last Client Name row
Set wsMDS = Worksheets("MDS Equipment Detail")
Set headerMDS = wsMDS.Rows(rowHeaderMDS)
'get last Client Name row
iCol = GetColumnNumber("Client Name", headerMDS)
With wsMDS
rowDataEndMDS = .Cells(.Rows.Count, iCol).End(xlUp).row
End With
'added 11/27/2017
If rowDataEndMDS < 7 Then
MsgBox "No Data on MDS to copy to MOST"
Exit Sub
End If
Set rMDS = wsMDS.Rows(rowDataStartMDS).Resize(rowDataEndMDS - rowDataStartMDS + 1)
Range(wsIBMass.Rows(rowDataStartIBMass), wsMOST.Rows(rowDataEndMDS)).EntireRow.Delete
'Fields to be filled in when Copy from MDS to IB Mass Creation macro is enabled
For i = rowDataStartMDS To rowDataEndMDS
With wsIBMass.Rows(i - 2)
' LUV(headerMOST, "Config Serial Number" & vbLf & "Manufacturer serial if no Configured serial", i - 2).Value = LUV(headerMDS, "Oracle Configuration SN", i).Value
.Cells(2).Value = LUV(headerMDS, "Serial Number", i).Value
.Cells(16).Value = LUV(headerMDS, "Ricoh Equipment ID", i).Value
.Cells(21).Value = LUV(headerMDS, "Department Name (if required)", i).Value
.Cells(22).Value = LUV(headerMDS, "Cost Center (if required)", i).Value
.Cells(45).Value = LUV(headerMDS, "IP Address", i).Value
.Cells(50).Value = LUV(headerMDS, "MAC Address", i).Value
End With
Next i
Application.ScreenUpdating = True
MsgBox "The data has been copied to the IB Mass Creation worksheet. Please verify that the data has copied over properly!"
End Sub