Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Copy paste a formula in multiple cells

I dont have consecutive cells ,I have cells like G3, G6, G9... uptil G500 or so
How should I copy paste a formula into these cells without manually
selecting all these cells using ctrl key

Is there a way to select these cells and copy paste the formula


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy paste a formula in multiple cells

Assuming that the cells are incrementing by 3.... and shCurrent is the name
of your worksheet in question. Here is the code:

Dim rSelect As Range
Dim strRange As String
Dim nRange As Integer

strRange = "G3"
For nRange = 6 To 500 Step 3
strRange = strRange & ",G" & nRange
Next nRange

Set rSelect = shCurrent.Range(strRange)
shCurrent.Cells(1, 1).Copy
rSelect.Select
shCurrent.Paste
Application.CutCopyMode = False

*** One Final Note: I test out the above and find that the 500 is too much
for Excel to handle. 174 is the limit. So I suggest that you divide into
chunks of 150-loop iterations. That is:
For nRange = 6 To 150 Step 3
For nRange = 153 To 300 Step 3
For nRange = 303 To 500 Step 3



"vijaya" wrote:

I dont have consecutive cells ,I have cells like G3, G6, G9... uptil G500 or so
How should I copy paste a formula into these cells without manually
selecting all these cells using ctrl key

Is there a way to select these cells and copy paste the formula


Reply
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
Trying to copy and paste line of text into multiple cells .Net Sports Excel Discussion (Misc queries) 1 October 21st 08 02:10 AM
macro copy/paste data from multiple cells to multiple cells Diana Excel Discussion (Misc queries) 0 July 10th 06 09:24 PM
Copy/Paste how to avoid the copy of formula cells w/o calc values Dennis Excel Discussion (Misc queries) 10 March 2nd 06 10:47 PM
Copy paste a formula in multiple cells vijaya Excel Programming 6 November 4th 05 07:22 AM
How to copy and paste same formula in multiple cells? Amanda Excel Worksheet Functions 1 June 30th 05 04:16 PM


All times are GMT +1. The time now is 01:33 AM.

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

About Us

"It's about Microsoft Excel"