Results 1 to 6 of 6

Make a loop in created macro

Threaded View

keis386 Make a loop in created macro 06-07-2012, 04:25 PM
TMS Re: Make a loop in created... 06-07-2012, 04:57 PM
keis386 Re: Make a loop in created... 06-07-2012, 05:19 PM
TMS Re: Make a loop in created... 06-07-2012, 05:29 PM
keis386 Re: Make a loop in created... 06-08-2012, 03:08 AM
TMS Re: Make a loop in created... 06-08-2012, 03:15 AM
  1. #1
    Forum Contributor
    Join Date
    01-17-2011
    Location
    amsterdam, Netherlands
    MS-Off Ver
    Excel 2007
    Posts
    189

    Make a loop in created macro

    Hi,

    I created a macro but I do not know how I can make a loop in the function?
    Hope someone can help me. I also attached my excel file


    Sub YEPP()

    If Not IsEmpty(Range("B2")) Then

    Range("B2:B8").Select
    Selection.Copy
    Range("B3").Select
    ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
    IconFileName:=False

    Range("B2").Select
    Selection.ClearContents

    Range("B2").Select
    Application.CutCopyMode = False
    ActiveCell.FormulaR1C1 = "=TODAY()"
    Range("B2").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False

    Range("H2:H8", "I2:I8").Select
    Selection.Copy
    Range("H3", "I3").Select
    ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, _
    IconFileName:=False

    Range("H2", "I2").Select
    Selection.ClearContents

    End If
    End Sub

    Function of the macro is that if there is a value in B2 then B2:B8 is copied to B3:B9, also value of day of today is inserted in B2
    value in B2 has to be deleted, H2:I8 copied to H3:I9, and values in H2:I2 are deleted.
    Next do the same thing in cell B10 look if there is a value in B10, ….
    Next do the same thing in cell B18…
    etc…
    Attached Files Attached Files
    Last edited by keis386; 06-08-2012 at 03:07 AM.

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