Results 1 to 3 of 3

Using a button to pull data from another worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    01-27-2012
    Location
    texas
    MS-Off Ver
    Excel 2007
    Posts
    2

    Unhappy Using a button to pull data from another worksheet

    Hi, I am brand new with VB, so I am completely lost with this.

    My workbook contains a report, that consists of two pages: a Data sheet and a Pulse sheet. I am trying to add a button that, when clicked, fetches information from the Pulse sheet and plugs it into the data sheet. The trick is that the data is pulled and copied to multiple lines and columns. I found this code on a forum, so decided to try it:

    Sub Button1_Click()
    '
    ' Button1_Click Macro
    ' Pulls data from other worksheet
    '
    ' Keyboard Shortcut: Ctrl+d
    '
        Selection.OnAction = "Button1_Click"    
    Application.Goto Reference:="Button1_Click"
    Worksheets("Data").Range("E6").Value = Worksheets("Pulse - Dec-11").Range("N7")
    Worksheets("Data").Range("E7").Value = Worksheets("Pulse - Dec-11").Range("N8")
    Worksheets("Data").Range("E8").Value = Worksheets("Pulse - Dec-11").Range("N9")
    Worksheets("Data").Range("E9").Value = Worksheets("Pulse - Dec-11").Range("N10")
    Worksheets("Data").Range("E10").Value = Worksheets("Pulse - Dec-11").Range("N11")
    Worksheets("Data").Range("E11").Value = Worksheets("Pulse - Dec-11").Range("N12")
    
        With Selection.Characters(Start:=1, Length:=8).Font
            .Name = "Arial"
            .FontStyle = "Regular"
            .Size = 10
            .Strikethrough = False
            .Superscript = False
            .Subscript = False
            .OutlineFont = False
            .Shadow = False
            .Underline = xlUnderlineStyleNone
            .ColorIndex = xlAutomatic
            .TintAndShade = 0
            .ThemeFont = xlThemeFontNone
        End With
        Range("B1").Select
        ActiveSheet.Shapes("Button 1").Select
        Application.Goto Reference:="Button1_Click"
    End Sub
    When I hit the button, it gives me a run-time error '438' - Object doesn't support this property or method and it highlights the red text above (Selection.OnAction = "Button1_Click")

    Any help? I can give more info, just let me know what you need. Thank you!!
    Last edited by btrfly701; 01-27-2012 at 10:59 AM.

Thread Information

Users Browsing this Thread

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

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