+ Reply to Thread
Results 1 to 2 of 2

Select lines of data that contain words from column F drop down

Hybrid View

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Question Select lines of data that contain words from column F drop down

    I am trying to paste a macro into VBA that will select lines of data that contain the column F drop down "BRING FORWARD / À REVOIR" selection in sheet 2 to sheet 10 using the code below.
    The idea is that I have a list of just the bring forward lines on sheet 10.

    This is the error message I am getting.....Anyone familliar with it?

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim rng As Range
        Dim destSht As Worksheet: Set destSht = Sheets("Sheet10")
        Dim destLR As Long: destLR = destSht.Range("F" & Rows.Count).End(xlUp).Row + 1
        Set rng = Target.Parent.Range("F:F")
        If Target.Count > 1 Then Exit Sub
        If Intersect(Target, rng) Is Nothing Then Exit Sub
        Application.ScreenUpdating = False
        If Target.Value = "BRING FORWARD / À REVOIR" Then
            Debug.Print destLR
            Target.EntireRow.Copy Destination:=destSht.Range("A" & destLR)
        End If
        Application.ScreenUpdating = True
    End Sub
    The hilighted error is
    : Set destSht = Sheets("Sheet10")

  2. #2
    Registered User
    Join Date
    09-04-2012
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Select lines of data that contain words from column F drop down

    The problem was that the sheet was not named "Sheet10" I had renemed it

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1