+ Reply to Thread
Results 1 to 2 of 2

Working with Ranges

  1. #1
    Registered User
    Join Date
    04-25-2009
    Location
    Norway
    MS-Off Ver
    Excel 2007
    Posts
    1

    Working with Ranges

    Hi guys,

    I need to write a very simple macro in VBA, so I hope someone will be willing to use a couple of minutes to help me with that.

    I just need to copy values from one range in Sheet1 into another range in Sheet3, but i must have 12 empty rows under every row from the original range. In this 12 rows I need to paste another range, filled with formulas.

    I will try to be more specific by giving an example. I have three ranges:
    Please Login or Register  to view this content.
    So I need to copy the values from the first row in Range1 and paste them into the first row in Range3. Then I want to copy the formulas in Range2 and paste them into the next 12 rows of Range3. So I copy row 2 from Range1 and paste it into row 14 in Range3. Then again i paste Range2 into the next 12 rows of Range3, and so on.

    I hope that this description was understandable. The macro should be very easy to write, I think, but I know almost nothing of VBA. I could write this program myself using a simple For Loop statement, but the problem is that it seems to be much harder to work with ranges, than with two-dimensional arrays. VBA does not seem to accept ranges of the type Range("Ai:BHBk"), where i and k are long variables...

    Anyway, thenks for the help!
    Last edited by VBA Noob; 04-25-2009 at 11:33 AM. Reason: Added code tags

  2. #2
    Administrator JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Working with Ranges

    Quote Originally Posted by Gooner View Post
    VBA does not seem to accept ranges of the type Range("Ai:BHBk"), where i and k are long variables...
    Of course it does. You simply have to declare those variables first, solve for their values second, then insert them into the VBA reference...and you're right, that can fit nicely into a Loop...
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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