+ Reply to Thread
Results 1 to 11 of 11

How do you tweak the VBA code to repeat a macro for entire column

  1. #1
    Registered User
    Join Date
    02-26-2017
    Location
    Manchester
    MS-Off Ver
    Office 2010
    Posts
    5

    How do you tweak the VBA code to repeat a macro for entire column

    Hi,

    i am just trying to get grip around Macros, and was wondering, if there is a simple solution to repeat a macro for entire column.

    For instance the macro below was recorded for only 10 rows, but it will be useful, if I could repeat it to 1000 rows.

    Many Thanks.

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Code that does not do what you want it to do is normally of no use.
    Explain what you want to accomplish.

  3. #3
    Registered User
    Join Date
    02-26-2017
    Location
    Manchester
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Ok. I have two column here with data in separated by 8 rows. This runs for approx 3000 rows.
    Example
    NaN 1.2




    0.8 2




    0.7 2.7


    All I wanted to do was to interpolate between the second column, as the first column represents unequal intervals (difference between the two succesive column 2 values).

    So my final value table should look like

    NaN 1.2 1.2
    <> <> 1.3
    <> <> 1.4
    <> <> 1.5
    <> <> 1.6
    <> <> 1.7
    <> <> 1.8
    <> <> 1.9
    0.8 2 2
    <> <> 2.0875
    <> <> 2.175
    <> <> 2.2625
    <> <> 2.35
    <> <> 2.4375
    <> <> 2.525
    <> <> 2.6125
    0.7 2.7 2.7


    Regards
    Last edited by Deepanshu_S; 02-26-2017 at 07:29 PM.

  4. #4
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: How do you tweak the VBA code to repeat a macro for entire column

    I do not understand what you are trying to do.

    I have tidied up your code for you.



    Please Login or Register  to view this content.
    Last edited by mehmetcik; 02-26-2017 at 07:42 PM.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  5. #5
    Registered User
    Join Date
    02-26-2017
    Location
    Manchester
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Hi mehmetcik,

    Thanks, for correcting the vba code. However, it still does not repeat the process on 3000 rows of data and repeats it to only first 10 rows
    Any suggestions.

    thanks,
    Deep

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,420

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Post a sample workbook with some typical data. It's difficult to follow your requirements.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  7. #7
    Registered User
    Join Date
    02-26-2017
    Location
    Manchester
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Quote Originally Posted by TMS View Post
    Post a sample workbook with some typical data. It's difficult to follow your requirements.
    I have attached a sample file, where a macro is active for the first 10 rows, but I would like it to follow all the way until data is there in range of Column A:B
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: How do you tweak the VBA code to repeat a macro for entire column

    You could try this on a copy of your workbook.
    Please Login or Register  to view this content.

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Slightly less interaction with the sheet.
    Could be a little faster on a large range.
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    02-26-2017
    Location
    Manchester
    MS-Off Ver
    Office 2010
    Posts
    5

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Quote Originally Posted by jolivanes View Post
    Slightly less interaction with the sheet.
    Could be a little faster on a large range.
    Please Login or Register  to view this content.
    Many thanks @jolivanes. The macro works sweet. This has been really helpful. Will keep track of more forum posts to pick up tips and codes. Cheers!!

  11. #11
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,519

    Re: How do you tweak the VBA code to repeat a macro for entire column

    Thank you for letting us know that all works as needed.
    Good luck

+ 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. Merge cell with blanks below and repeat for entire column.
    By kleptilian in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-04-2015, 12:34 PM
  2. Tweak Macro to return entire row if match found
    By capson in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-16-2014, 02:32 PM
  3. [SOLVED] Tweak Code "change the column number to column letter" in Macro
    By capson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-22-2013, 10:44 AM
  4. Macro code to delete entire row if the cell in column C = 0
    By glock9mm in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2013, 02:50 PM
  5. VBA code to make a macro repeat as long as there is data in the column
    By dkassin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-28-2012, 06:42 PM
  6. Repeat for entire column
    By Kochanski in forum Excel General
    Replies: 4
    Last Post: 12-01-2010, 05:32 AM
  7. How to repeat a function through an entire column
    By gfoulks in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-16-2005, 08:19 PM

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