+ Reply to Thread
Results 1 to 9 of 9

Recording dynamic range using ctrl+ arrow keys not working

  1. #1
    Registered User
    Join Date
    01-30-2014
    Location
    .
    MS-Off Ver
    Excel 2010
    Posts
    6

    Recording dynamic range using ctrl+ arrow keys not working

    Hi,

    I am trying to record a macro for inserting table with existing data in cells. The range of cells vary every time in columns and rows.
    While recording I am using ctrl + shift + arrow keys to select range(dynamic), but the selection stops in between even if there is data in next row.
    I have to press again the down arrow key. This happens only in some cases so I cannot record the macro with pressing down arrow key for 2 times.
    Sometimes it happens for 3-4 times as well. I have attached the file in which the selection stops at second row.
    I am not able to figure it out. Is there any other way select range containing data.

    Thanks a lot.
    Attached Files Attached Files
    Last edited by akshay12; 06-25-2014 at 10:18 AM.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Recording dynamic range using ctrl+ arrow keys not working

    Hi ashkay12,

    There are many ways to do what you want. See the attached workbook with a simple example that uses Workbook_SheetSelectionChange() in the 'ThisWorkbook' module.

    We have to have more specific information on what you are trying to do in order to help you further.

    Please Login or Register  to view this content.
    Lewis
    Attached Files Attached Files

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Recording dynamic range using ctrl+ arrow keys not working

    Hi, akshay12,

    maybe (using Select here for demonstration only)
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    Using MergedCells will create all sorts of trouble for VBA code, you should get rid of these ASAP.

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  4. #4
    Registered User
    Join Date
    01-30-2014
    Location
    .
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Recording dynamic range using ctrl+ arrow keys not working

    Hi,

    Thanks for the reply Lewis & Holger.

    To be more detailed, I get a report file in excel format exported by the erp.
    This file has data in tabular format one below the other, i.e. there are number of tables(not in excel table format) one below the other.
    I need to have filter on all these tabular data, so I have to convert them into table by selecting range and 'insert table'
    The range is dynamic, the number of rows change every time in every tabular data.
    I need to have a macro which could select the range and convert it into excel table and then move on and then select the next range and then convert it to table too.
    Yes I found that the problem in selection by using ctrl+shift+ arrow keys is due to merged cells.

    I was thinking to have a macro which would select the data range with cell borders and convert it into table and then find the next tabular data with cell borders and select them
    and convert them into table. Since I am sure that the data cells will have borders always.
    To create a table I have to have only one data range selected at a time since excel can insert table only for one data range at a time.

    Thanks a lot again.

  5. #5
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Recording dynamic range using ctrl+ arrow keys not working

    If you can provide a sample workbook with two (small) sample tables we may be able to help you. Chances are there are unique identifiers (such as specific Header items) that can help automate this task.

    Lewis

  6. #6
    Registered User
    Join Date
    01-30-2014
    Location
    .
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Recording dynamic range using ctrl+ arrow keys not working

    Hi Lewis,

    I have attached the file here. I used the fill color to locate the headers.
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-30-2014
    Location
    .
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Recording dynamic range using ctrl+ arrow keys not working

    In case the earlier file does not opens.

    Thanks!!

    akshay
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Recording dynamic range using ctrl+ arrow keys not working

    Hi,

    Your workbook was extremely helpful.

    See the attached workbook, based on your file. It contains two additional Sheets:
    a. Sheet 'Sheet1' which contains a list of Tables to be processed.
    b. Sheet 'Destination' where the data is copied to. At the current time only the LAST TABLE is copied to the 'Destination Area' starting in cell 'A1'.

    Some intermediate results are displayed in the debugger 'Immediate Window' (CTRL G) in the debugger. An Excerpt of those results for the first two tables follows:
    Please Login or Register  to view this content.
    The next step is to decide the destination to copy each table to and what you want copied:
    a. Everything for each table including the 'Table Type Sentinel'.
    b. Data Table only including Header.
    c. Data only (no header)
    d. Copy values only or copy values and formats.
    e. Destination Workbook (can be the source workbook) for each table.
    f. Destination Sheet for each table.
    g. Destination Start Cell for each table (including appending to existing tables).

    Lewis
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    01-30-2014
    Location
    .
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Recording dynamic range using ctrl+ arrow keys not working

    Hi Lewis,

    Thanks for the help.
    Sorry for the late reply. I was getting a sample from my counterparts.
    I am looking into the code but I would like to share the required output as well.
    Thanks for the great help.
    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)

Similar Threads

  1. Ctrl + arrow key not working
    By DamienC in forum Excel General
    Replies: 9
    Last Post: 04-01-2016, 05:23 AM
  2. Ctrl + Arrow key isn't working the way I need it to
    By ipausa in forum Excel General
    Replies: 2
    Last Post: 01-29-2014, 11:00 AM
  3. [SOLVED] Arrow Keys not working
    By DPKologie in forum Excel General
    Replies: 3
    Last Post: 03-23-2012, 03:50 PM
  4. CTRL + Arrow not working properly
    By rockets2010 in forum Excel General
    Replies: 2
    Last Post: 06-30-2011, 12:22 PM
  5. Arrow Keys not Working Properly
    By Raman325 in forum Excel General
    Replies: 4
    Last Post: 08-18-2005, 11:08 AM

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