Dim LastCol As Integer
Dim tbl_2Users As Range
Dim sName As String
Dim ThisWb As Workbook
Dim ThisWs As Worksheet
'
Set ThisWb = ActiveWorkbook
Set ThisWs = ws_2Users
'
'------------Start Remove any Bad Named Ranges---------------
With ThisWb
Call m_DeleteAllBadNamesThisWb
'------------End Remove any Bad Named Ranges---------------
'--Named Ranges (incomplete)---------------
'tbl_2Users
'ws_2Users_SearchRow
'ws_2Users_New
'ws_2Users_UPN
'ws_2Users_Email
'ws_2Users_SAM
'ws_2Users_RngUPN"
'ws_2Users_RngEmail
'ws_2Users_RngSAM
'
'--End List of Named Ranges-----------------------------------------
'------------Start Find Last Row and Last Column---------------
LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
'------------End Find Last Row and Last Column---------------
'------------Start Naming Ranges---------------
Range("A1", Cells(LastCol)).Name = "ws_2Users_SearchRow"
With Range("ws_2Users_SearchRow")
.Find(What:="UPN", LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Name = "ws_2Users_UPN"
.Find(What:="eMail", LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Name = "ws_2Users_Email"
'.Find(What:="SamAccountName", LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Name = "ws_2Users_SamAccountName"
.Find(What:="AtHocUserName", LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Name = "ws_2Users_AtHocUserName"
End With
Range("A1").Name = "ws_2Users_New"
Range("ws_2Users_New").Offset(1, 0).Resize(LastRow).Name = "ws_2Users_RngNew"
Range("ws_2Users_UPN").Offset(1, 0).Resize(LastRow).Name = "ws_2Users_RngUPN"
Range("ws_2Users_Email").Offset(1, 0).Resize(LastRow).Name = "ws_2Users_RngEmail"
Range("ws_2Users_username").Offset(1, 0).Resize(LastRow).Name = "ws_2Users_RngUsername"
Range("ws_2Users_SamAccountName").Offset(1, 0).Resize(LastRow).Name = "ws_2Users_RngSamAccountName"
Range("AtHocUserName").Offset(1, 0).Resize(LastRow).Name = "ws_2Users_RngAtHocUserName"
Range("AtHocUserName").Value = "AtHoc Username"