Results 1 to 6 of 6

Loop Problems

Threaded View

  1. #1
    Forum Contributor
    Join Date
    07-07-2014
    Location
    Göteborg
    MS-Off Ver
    2010
    Posts
    130

    Loop Problems

    Hi!

    I am very new to Macros and Vba in general so I need some help with a loop i need to do.

    I need to copy the range from "U10:X" & LastRow to "Q10:T" & LastRow in a loop until the last column in row 9.
    Good to know is that the LastRow will always be the same for every single loop.

    In other words I need to copy cell values and replace in four columns before and then delete the original numbers with a step on 8.

    My macro right now looks like this but it doesnt not work and is probably way off,

    Sub RefreshYear()
    
        Dim xxx As Long
        Dim yyy As Long
        Dim LastRow As Long
        Dim LastCol As Integer
        With ActiveSheet
            LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
        End With
        With ActiveSheet
            LastCol = .Cells(9, .Columns.Count).End(xlToLeft).Column
        End With
        For x = 21 To LastCol Step 8
            y = LastRow
            With ActiveSheet
            Range(Cells(10, x), Cells(y, 4 + x)).Selection Copy
            Range(Cells(10, x - 5), Cells(LastRow, x - 1)).PasteSpecial xlPasteValues
            End With
        Next x
    Would be great if someone could help me around.

    Sincerely,
    Niclas
    Last edited by vlady; 07-06-2015 at 03:14 AM. Reason: Use code tags around your codes. thank you.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Problems with IF and DO WHILE LOOP
    By Ymgarl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-05-2015, 03:02 PM
  2. Problems with a For Each loop
    By lordterrin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-27-2013, 02:10 PM
  3. Loop Problems
    By wesbuckley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-06-2009, 06:38 AM
  4. problems with loop
    By Arjan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2005, 05:20 AM
  5. So close! Problems with Loop
    By Linking to specific cells in p in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-07-2005, 02:06 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