+ Reply to Thread
Results 1 to 9 of 9

Importing selected cells into VBA

  1. #1
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    Importing selected cells into VBA

    Can you help with how to import into vba just the data in the currently selected cells?

    What I want to do is to manually select a range of rows (in a single column) and upon running the macro put the data from each cell into the uppermost cell with each seperated with a comma.

    I can manage the combining of the data but don't now the selection is read into VBA
    Last edited by tryer; 10-13-2008 at 03:06 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    manually select a range of rows (in a single column)
    Do you mean a range of cells in one column

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    Yes, sorry if I didn't explain clearly

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if this helps

    Please Login or Register  to view this content.
    VBA Noob

  5. #5
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    Thanks Noob that works a treat.

    Is there a way to delete the cells below selection(1) ? at the same time?

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Add
    Please Login or Register  to view this content.
    after
    Please Login or Register  to view this content.
    VBA Noob

  7. #7
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357

    trying to understand

    Noob this works perfectly. However I'm struggling to understand the line
    Please Login or Register  to view this content.
    presumably Selection (1) selects the first cell in the range but don't know what the 9^9 bit does?

  8. #8
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    I use the mid function to get rid of the extra comma at the start.
    Type =9^9 in a cell and it returns 387420489. This makes sure it shouldn't cut off any cells at the end of the mid function

    Selection (1) selects the first cell in the range
    Correct

    VBA Noob

  9. #9
    Valued Forum Contributor
    Join Date
    11-16-2004
    Location
    Devon UK
    MS-Off Ver
    2010
    Posts
    357
    Thanks that's great

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. average of cells from user selected range of worksheets
    By ge0rge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-05-2008, 07:34 AM
  2. bug: cells selected as mouse moves
    By urungus in forum Excel General
    Replies: 5
    Last Post: 08-28-2008, 09:39 PM
  3. Manual calculating selected cells only
    By pauldaddyadams in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2008, 04:05 AM
  4. importing text but it spreads across cells
    By robin.a in forum Excel General
    Replies: 2
    Last Post: 10-15-2006, 12:36 AM

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