ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to copy selected data (https://www.excelbanter.com/excel-programming/323735-how-copy-selected-data.html)

Metin

How to copy selected data
 
Hallo,

I have the next macro which is based to make a calculation with specific
selected data. Now I don't want to do a calculation, but just copy the
selected data to a different place in the same worksheet. How can I do this
with VBA.

wks.Name = "Sheet1"

j = 13
For i = 1 To 4
wks.Select
Set rng = Range("C2:C97")
avgWT = Application.SumIf(rng, "WT", rng.Offset(0, j)) / _
Application.CountIf(rng, "WT") 'This is line has to change
Range("AR20".Offset(0, i - 1).Value = avgWT
j = j + 1
Next



All times are GMT +1. The time now is 12:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com