+ Reply to Thread
Results 1 to 2 of 2

My macro needs a couple tweeks- Fairly simple copy and paste macro

Hybrid View

wiebs2334 My macro needs a couple... 05-11-2013, 06:34 PM
AlphaFrog Re: My macro needs a couple... 05-11-2013, 08:23 PM
  1. #1
    Registered User
    Join Date
    05-11-2013
    Location
    United States
    MS-Off Ver
    Excel 2011 Mac
    Posts
    8

    My macro needs a couple tweeks- Fairly simple copy and paste macro

    I am having issues with this code since im not 100% familiar with VB yet
    Sub Submit_Round()
    '
    ' Submit Round to Totals/Handicap Page
    '
    Dim NextCol As Long  
        Range("DL12:DL47").Select
        Selection.Copy
        Sheets("Totals & Handicap").Activate 
        For NextCol = 2 To 201
            If Cells(3, NextCol) = "" Then
                Range(Cells(3, NextCol), Cells(36, NextCol)).Paste
            End If
        Next NextCol       
    End Sub
    I would like to copy DL12:DL47 of the sheet I run the macro from, then move to Totals & Handicap and paste it in B3:B36 unless that range is used then I want it in C3:C36, ect. Is there a command to stop a loop like "break" in c++or java (cant remember which one, maybe both)? Or should I just use "Do While" instead of "For"
    Last edited by wiebs2334; 05-11-2013 at 06:45 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: My macro needs a couple tweeks- Fairly simple copy and paste macro

    Try this...

    Sub Submit_Round()
    '
    ' Submit Round to Totals/Handicap Page
    '
        Range("DL12:DL47").Copy _
            Destination:=Sheets("Totals & Handicap").Cells(3, Columns.Count).End(xlToLeft).Offset(, 1)
    End Sub
    BTW: Exit For will exit a For-Next loop.

+ 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