ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   Counting entries and copying (https://www.excelbanter.com/new-users-excel/135443-counting-entries-copying.html)

pcor

Counting entries and copying
 
I have a number of entries in Col A & B
The number varies, could be 100 and it could increase
I would like to have a macro that would copy these entries as follows:
Lets assume that I have 100 entries in A & B-Starting at A1 & B1
I want to leave the first 25 where they are
Then take entries 25 to 50 and COPY them to col d & E(starting at D1 & E1)
Then take the next quarter (51 to 75) and COPY them to col G & H
Then copy the last quarter to Col J & K
Thanks for the help



Gary''s Student

Counting entries and copying
 
Sub pcor()
Set r1 = Range("A25:B50")
Set r2 = Range("A51:B75")
Set r3 = Range("A76:B100")
Set r1d = Range("D1")
Set r2d = Range("G1")
Set r3d = Range("J1")
r1.Copy r1d
r2.Copy r2d
r3.Copy r3d
End Sub

--
Gary''s Student
gsnu200711


"pcor" wrote:

I have a number of entries in Col A & B
The number varies, could be 100 and it could increase
I would like to have a macro that would copy these entries as follows:
Lets assume that I have 100 entries in A & B-Starting at A1 & B1
I want to leave the first 25 where they are
Then take entries 25 to 50 and COPY them to col d & E(starting at D1 & E1)
Then take the next quarter (51 to 75) and COPY them to col G & H
Then copy the last quarter to Col J & K
Thanks for the help



pcor

Counting entries and copying
 
That would only work if col a & B contained exactly 100 entries. As I said
before the number of entries in Col A & A will vary from 80 to 200 on a
regular basis
But thanks for the help. much appreciated


"Gary''s Student" wrote:

Sub pcor()
Set r1 = Range("A25:B50")
Set r2 = Range("A51:B75")
Set r3 = Range("A76:B100")
Set r1d = Range("D1")
Set r2d = Range("G1")
Set r3d = Range("J1")
r1.Copy r1d
r2.Copy r2d
r3.Copy r3d
End Sub

--
Gary''s Student
gsnu200711


"pcor" wrote:

I have a number of entries in Col A & B
The number varies, could be 100 and it could increase
I would like to have a macro that would copy these entries as follows:
Lets assume that I have 100 entries in A & B-Starting at A1 & B1
I want to leave the first 25 where they are
Then take entries 25 to 50 and COPY them to col d & E(starting at D1 & E1)
Then take the next quarter (51 to 75) and COPY them to col G & H
Then copy the last quarter to Col J & K
Thanks for the help




All times are GMT +1. The time now is 04:07 PM.

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