Need to modify macro -- need help

brian_123

New Member
Joined
Mar 11, 2002
Messages
10
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
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
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
 
Upvote 0

Forum statistics

Threads
1,213,531
Messages
6,114,167
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top