+ Reply to Thread
Results 1 to 3 of 3

Thread: Issue with Macros and Export functions

  1. #1
    Registered User
    Join Date
    08-29-2009
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    3

    Red face Issue with Macros and Export functions

    I've been searching the Internet for the past two days and couldn't find any solution... here is the problem...

    I have a table with 3 columns and 4 rows (including headers on the first row) . I have to use combo box or list box and put all the headers (on the first row) in it so that when I click on a drop-down button it will show all the list of headers (text). Then, when select a header from the list, the values (on multiple rows) under that header will be selected automatically.

    Then I would like to create 3 buttons to export all the selected values under that header (column) to SharePoint in 3 different files Excel, Word, and Powerpoint.

    This way I need to send out 1 column at a time not the whole table.

    Any help would be highly appreciated.

    Thank you.
    P.S. I am using Excel 2007
    Last edited by mess07; 08-29-2009 at 10:15 PM.

  2. #2
    Forum Guru, retired Admin royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    25,639

    Re: Issue with Macros and Export functions

    With sch a small table why bother with code to select the column?

    Add a ComboBox from the Controls Toolbar then use this code
    Option Explicit
    
    Private Sub ComboBox1_Change()
        Dim Col    As Long
        Col = Me.ComboBox1.ListIndex + 1
        Range(Cells(1, Col), Cells(Rows.Count, Col).End(xlUp)).Copy
    End Sub
    
    Private Sub Worksheet_Activate()
        Dim rng    As Range
        Dim cl     As Range
        Set rng = Range("A1:C1")
        Me.ComboBox1.Clear
        For Each cl In rng
            Me.ComboBox1.AddItem cl.Value
        Next cl
    End Sub
    This will load the combobox & copy the selected column.
    Attached Files Attached Files
    Last edited by royUK; 08-30-2009 at 04:11 AM.
    Hope that helps.

    RoyUK
    --------
    If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need

    For Excel Tips & Solutions, free examples and tutorials why not check out my downloads

    New members please read & follow the Forum Rules

    Remember to mark your questions Solved and rate the answer(s)

  3. #3
    Registered User
    Join Date
    08-29-2009
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Issue with Macros and Export functions

    Thanks a lot royUK for the quick solution...
    I've tried the code but for some reason it is giving me error saying "Me" is not define, not sure what does that mean.

    I am attaching the actual file, may be it will explain you better as to what I am trying to achieve here.

    Thank you!!
    Attached Files Attached Files

+ Reply to Thread

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.2.0