#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Copy If

I have data in cells A1..L1. I have a condition (A,B or C) in cells
H30..S30. Cell A1 corresponds to h30, B1 to I30, etc.

I need a routine that will copy and paste the data down 6 rows based up on
the condition. So for each cell in H30..S30 that has A in it, the routine
will then paste the value 6 rows down.

Any help is appreciated.

Regards
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 129
Default Copy If

This may get you started. You can modify the range as needed.

Sub Copyif()
Dim MyRange As Range
Dim MyCell As Range
Set MyRange = Range("H30:S30")
For Each MyCell In MyRange
If MyCell.Value = "A" Then
MyCell.Copy Destination:=Range(MyCell.Address) _
.Offset(6, 0)
End If
Next
End Sub


Ronbo wrote:
I have data in cells A1..L1. I have a condition (A,B or C) in cells
H30..S30. Cell A1 corresponds to h30, B1 to I30, etc.

I need a routine that will copy and paste the data down 6 rows based up on
the condition. So for each cell in H30..S30 that has A in it, the routine
will then paste the value 6 rows down.

Any help is appreciated.

Regards


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
Copy and paste versus copy and insert copied cells Alana New Users to Excel 1 September 28th 07 08:58 PM
A visual basic value copy BUG?? - accounting format has copy problem!! [email protected] Excel Programming 3 June 20th 06 04:42 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 formulas from a contiguous range to a safe place and copy them back later Lucas Budlong Excel Programming 2 February 22nd 06 08:26 PM
EXCEL FILE a copy/a copy/a copy ....filename ve New Users to Excel 1 September 29th 05 09:12 PM


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

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"