1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

I get a VBA Excel 'Compiler Error: Object required'-Error. I am new to VBA coding, any help is aspir

Discussion in 'VBA Macros' started by Bob G., Sep 15, 2014.

  1. Bob G.

    Bob G. New Member

    Code (vb):

    Sub TF()
      Dim rng As Range
      Dim i As Long
      Dim TF As Long 'Value 'Range
     Set TF = Application.Match("TF", Sheets("Update").Range("1:1"), False) '.Value

      With ActiveSheet
      Set rng = .Range("A1:A" & .Cells(.Rows.Count, 1).End(xlUp).Row)
      For i = 2 To rng.Rows.Count
      rng.Cells(i, 4) = Application.WorksheetFunction.VLookup(.Cells(i, 1), Sheets("Update").Range("A:AZ"), TF, False)
      End With
    End Sub
  2. Luke M

    Luke M Excel Ninja

    The 'Set' method is used to define Objects. However, your TF variable is a Long (a number). So, change this line:
    Set TF = Application.Match("TF", Sheets("Update").Range("1:1"), False) '.Value
    to this"
    TF = Application.Match("TF", Sheets("Update").Range("1:1"), False) '.Value

Share This Page