+ Reply to Thread
Results 1 to 9 of 9

Macro on Specified cells

  1. #1
    Registered User
    Join Date
    09-21-2013
    Location
    India
    MS-Off Ver
    Excel 20
    Posts
    6

    Macro on Specified cells

    Hi gusy, i am new to macros and have written a macro which inserts few rows and then coverts text present in one cell which are separated by delimiters from texts to columns and then transposes it and gets copied as rows doing paste special which were inserted first. i can run the macro on only one cell at a time to get the result. but now i want to run the macro on other C2,C24,C46,C68....so on cells. how can i do it ??
    Attached Files Attached Files

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,099

    Re: Macro on Specified cells

    Hi, max548,

    I assume that your active cell when starting the macro is C2. Code goes into a normal modiule not behind a sheet. In this case I would start at the bottom of the list and work my way towards row 2:

    Please Login or Register  to view this content.
    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

  3. #3
    Registered User
    Join Date
    09-21-2013
    Location
    India
    MS-Off Ver
    Excel 20
    Posts
    6

    Re: Macro on Specified cells

    Hi holger,

    Thank you very much for the quick response... Appreciate it all

    In the previous code the word "ALLNEWSPLUS" was being inserted at the end of the row (C23), but while i was using this code it places this word in another cell (B23). Could you please have a look once...

    I have attached an excel sheet and highlighted the cells in yellow which states the result after previous macro was performed the result is placed in "Before Code" and after your code was performed the result is placed in "After Code"
    Attached Files Attached Files

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,099

    Re: Macro on Specified cells

    Hi, max548,

    the posted code used
    Please Login or Register  to view this content.
    for getting into Column B (-1 after the comma means one Column to the left), you might need to change it to read
    Please Login or Register  to view this content.
    for placing the value in Column C.

    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    09-21-2013
    Location
    India
    MS-Off Ver
    Excel 20
    Posts
    6

    Re: Macro on Specified cells

    thank you holger.....

    i got the desired result ......

  6. #6
    Registered User
    Join Date
    09-21-2013
    Location
    India
    MS-Off Ver
    Excel 20
    Posts
    6

    Re: Macro on Specified cells

    Hi Holger,

    Can u check this code . i want to run this macro on D2,D3...so on. where D2 is the active cell.. i want to run the
    macro for the whole column at once instead of each individual cell .
    Attached Files Attached Files
    Last edited by max548; 09-24-2013 at 01:40 PM.

  7. #7
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,099

    Re: Macro on Specified cells

    Hi, max548,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger

  8. #8
    Registered User
    Join Date
    09-21-2013
    Location
    India
    MS-Off Ver
    Excel 20
    Posts
    6

    Re: Macro on Specified cells

    hi,

    i have removed the code could you please help me on this......

  9. #9
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,099

    Re: Macro on Specified cells

    Hi, max548,

    as far as I remember you may apply the TextToColumns to the whole area at once while Im having trouble to imagine a way to insert rows and different contents in one take. You might like to use an array or dictionary to do so in VBA: read in the contents ot the sheet, work on the data, write back to the sheet.

    Ciao,
    Holger

+ 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. Macro to Remove Cells = 0 and Shift Remaining Cells on Row Left w/ One Condition
    By Mark V. in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 06-07-2013, 12:45 PM
  2. Looking to create a macro that will skip blank cells in a column, find data cells
    By crayzwalz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2013, 09:01 AM
  3. Replies: 0
    Last Post: 03-21-2013, 02:46 AM
  4. [SOLVED] Macro to repeat action too a range of cells with assending numbers in the cells.
    By 2k05gt in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-05-2012, 02:13 PM
  5. Macro to format cells, adjust column widths, hide cells
    By amsolmyers in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2010, 04:44 PM

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