+ Reply to Thread
Results 1 to 2 of 2

How to properly loop a subroutine with multiple dim variables

  1. #1
    Registered User
    Join Date
    06-25-2013
    Location
    Chicago, IL
    MS-Off Ver
    Office 365
    Posts
    6

    How to properly loop a subroutine with multiple dim variables

    Hello-

    I cobbled together this code to copy data from another opened workbook and paste it onto a different workbook exactly where I want it to. It works great but I am having a hard time figuring out how to repeat (maybe loop) it without simply pasting it 20 times and manually updating it.
    I need the subroutine to loop and instead of using my dimensional variable "Hilton1" to use "Hilton2", and then use "Hilton3" and so on. Thanks for your time.

    Please Login or Register  to view this content.
    Last edited by qualk23; 07-10-2020 at 01:56 PM.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: 2019 but still use also older versions
    Posts
    7,783

    Re: How to properly loop a subroutine with multiple dim variables

    Please take a moment to add the tags. 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, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then 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

    Consider also the hint given in a yellow banner near the top of the page
    Best Regards,

    Kaper

+ 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. Nested Do Until loop with multiple variables
    By tonypizza in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-30-2019, 02:38 PM
  2. [SOLVED] How to access variables that are declared in private subroutine
    By Pan314 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-23-2015, 10:07 PM
  3. [SOLVED] Multiple Variables in For Each Loop
    By Excel Guy 123 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-16-2014, 11:47 PM
  4. passing variables to subroutine from userform
    By PD3 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-07-2013, 02:11 AM
  5. [SOLVED] calling Subroutine is not working properly
    By kiran527 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-05-2012, 01:24 AM
  6. Moving from For...Next loop to subroutine and back to loop
    By zabrahamson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-25-2011, 01:26 PM
  7. Subroutine question and public variables
    By musictech in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2005, 05:05 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