Offset a Single Cell Range then Autofill Range with Formula

Shiseiji

Board Regular
Joined
Oct 23, 2009
Messages
166
Office Version
  1. 2016
  2. 2013
Platform
  1. Windows
Hope this makes sense as my searches have failed.
I would like to start my Match with an Offset of a named range then Autofill the column. The Autofill is retaining the original Offset and not progressing from what is "C2" to "C3" etc. Is this possible?
Line of code is
VBA Code:
 .FormulaR1C1 = "=IF(ISERROR(MATCH(OFFSET(ws_3Admin1_UserLogOn, 1,0), ws_3Admin_RngUserLogOn,0)),""Yes"", """")"
Only commitment is to the smartest quickest code & TIA.

VBA Code:
    Sub m_ws_3Admin1_IsClosed()
'
'== Other Range Names Used==
' ws_3Admin1_UserLogOn
' ws_3Admin1_rngUserLogOn
' ws_3Admin_rngUserLogOn
'====================

    Dim LastCol As Integer
    Dim LastRow As Long
    Dim OneName As Name
    Dim rngName As Name
    Dim ThisWb  As Workbook
    Dim ThisWs  As Worksheet
    '
    Set ThisWb = ActiveWorkbook
    With ThisWb
    ws_1Summary.Activate
    Application.ScreenUpdating = True
    ActiveWindow.SmallScroll down:=0
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    '
    ws_3Admin1.Activate
    Set ThisWs = ws_3Admin1
    LastRow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
    LastCol = Cells(1, Columns.Count).End(xlToLeft).Column
'--Start---------------------
    With ThisWs
'--Start Naming Ranges---------------
    Range("A1").EntireColumn.Insert
    Range("A1").Name = "ws_3Admin1_IsClosed"
    Range("ws_3Admin1_IsClosed").Value = "Closed Account"
    Range("ws_3Admin1_IsClosed").Offset(1, 0).Resize(LastRow).Name = "ws_3Admin1_RngIsClosed"
'--End Naming Ranges---------------
    With Range("ws_3Admin1_IsClosed").Offset(1, 0)
        .FormulaR1C1 = "=IF(ISERROR(MATCH(OFFSET(ws_3Admin1_UserLogOn, 1,0), ws_3Admin_RngUserLogOn,0)),""Yes"", """")"
        .AutoFill Destination:=Range("ws_3Admin1_RngIsClosed"), Type:=xlFillDefault
        .Calculate
'        .Copy
'        .PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
'        .Application.CutCopyMode = False
    End With
   Range("ws_3Admin1_IsClosed").Columns.AutoFit
   Range("A1").Activate
   End With 'ThisWs
'--End--------------------------------------------------------------
     ws_1Summary.Activate
     Application.ScreenUpdating = True
     If ws_3Admin1.Visible = False Then ws_3Admin1.Visible = True Else ws_3Admin1.Visible = True
     Application.DisplayAlerts = True
     Application.StatusBar = True
BeforeExit:
      Application.OnTime Now + TimeSerial(0, 0, 0.1), "m_ClearStatusBar"
      Application.StatusBar = "Done finding closed Admin Accounts."
      Application.OnTime Now + TimeSerial(0, 0, 10), "m_ClearStatusBar"
    End With 'ThisWb
End Sub

Again, thanks!
Ron
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,143,677
Messages
5,720,246
Members
422,272
Latest member
ginkgoVil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top