Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Need to modify macro -- need help

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    10
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a program that writes to the column A "contact brian" every 10 line.

    I need to modify the program to add another line after that every 10th line the would have the words Item# in column A and Category in column B and price in column C

    Thanks

    Keyboard Shortcut: Ctrl+i
    '
    Position = 10
    Count = 0
    RangeString = "A0"

    Do While Count < 100
    RangeString = "A" & Position
    Range(RangeString).Select
    Application.CutCopyMode = False
    Selection.EntireRow.Insert
    ActiveCell.FormulaR1C1 = "contact Brian"
    Position = Position + 10
    Count = Count + 1
    Loop

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try this;

    Sub test()
    Position = 10
    Count = 0

    Application.ScreenUpdating = False

    Do While Count < 100
    Range("A" & Position).EntireRow.Insert
    With Range("A" & Position)
    .FormulaR1C1 = "contact Brian"
    .Offset(1, 0) = "Item#"
    .Offset(1, 1) = "catogory"
    .Offset(1, 2) = "price"
    End With
    Position = Position + 10
    Count = Count + 1
    Loop

    Application.ScreenUpdating = True
    End Sub


    Ivan

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •