LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Pasting formula in every nth row

hi,

I have a formula that needs to be pasted into every 5th row, only if there
is no existing formula in that target row.

I have about 30000 rows of data & 10 such spreadsheets. To hasten this task,
I wrote this code, but it is missing out pasting the formula on some rows
etc...

Sub Macro2()

Dim Count As Long


Range("B5:M5").Copy

For Count = 0 To 70 Step 5
If Range("B5").Offset(Count, 0).HasFormula Then
Count = Count + 5
Else
Range("B5").Offset(Count, 0).PasteSpecial
Paste:=xlPasteFormulas, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
Count = Count + 5
End If
Next Count

End Sub


TIA

Neil

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pasting Same Formula tc Excel Programming 2 May 18th 07 05:54 AM
copying and pasting a formula William Excel Worksheet Functions 2 November 22nd 05 12:25 AM
reading a formula and pasting it lawson Excel Programming 1 September 16th 05 09:13 PM
Pasting formula as text ExcelMonkey[_190_] Excel Programming 3 March 14th 05 11:48 PM
Pasting formula with defined name R. Choate Excel Programming 4 October 1st 04 08:21 PM


All times are GMT +1. The time now is 02:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"