Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Help to copy values

Richard,
Try this
Sub Macro1()
Dim i As Long, j As Long, LR As Long
i = 3
j = 74 'starting row of column Z
LR = Range("Z" & Rows.Count).End(xlUp).Row
Range(Cells(70, 3), Cells(70, 12)).ClearContents
Do Until i = 13 Or j = LR + 1
If Range("Z" & j).Value * Range("AA" & j).Value 0 Then
'if negative numbers are involved change above to
'Abs(Range("Z" & j).Value * Range("AA" & j).Value)
Cells(70, i).Value = Range("Z" & j).Value
i = i + 1
End If
'if "0"s in column Z to be listed include these lines
'If Range("Z" & j).Value = 0 And Range("AA" & j).Value < 0 Then
'Cells(70, i).Value = Range("Z" & j).Value
'i = i + 1
'End If
j = j + 1
Loop
End Sub

HTH
Cecil

"Richard" wrote in message
...
Could anyone help me with this please.
I have a Target range of C70 to L70 (10 cells).

How do I copy the numbers in ColumnZ which are adjacent to
the corresponding numbers in ColumnAA in the table below
to the Range C70 to L70. Sometimes after I run my macro,
there are more or less numbers in ColumnAA and I just want
to copy up to 10 numbers but only those from columnZ that
have a number in the same row beside them.

In my table, I need to copy 10,2,4,7,9,8,5 and 6, (a total
of 8 numbers in this case) to cells commencing with C70
across. Cells K70 and L70 would be blank in this example.
If there are more than 10 rows that have data in both Z
and AA the ones over 10 are ignored.

Row ColZ ColAA
74 10 4.7
75 2 5.1
76 4 6.6
77 7 8.2
78 9 12.7
79 8 17.4
80 5 20.9
81 6 21.2
82 11
83 12
84 13
85 14
86 15
87 16
88 17
89 18
90 19
91 20
92 21
93 22
94 23
95 24
96 25
97 26



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 between worksheets does not copy formulae just values Chris@1000 Oaks Excel Discussion (Misc queries) 0 March 19th 06 11:44 AM
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 values generated by conditional formula in one sheet to the other work sheet as values ramana Excel Worksheet Functions 1 October 5th 05 01:04 PM
compare values between workbooks and copy values bgardiner Excel Programming 0 September 9th 03 03:54 PM
Range COPY function - how to copy VALUES and not formulas James Cooke Excel Programming 1 August 21st 03 07:04 PM


All times are GMT +1. The time now is 03:43 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"