ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying ranges to various locations (https://www.excelbanter.com/excel-programming/392359-copying-ranges-various-locations.html)

Memento

Copying ranges to various locations
 
Ok guys,

I'm struggeling a while already with this one,

I have 15 ranges with a medium size. At first the worksheet is empty, and
there's a button on it "New user". Basically the idea is when a new user is
introduced, one could hit the button, give the name of the user, and the
range "UserRange" gets pasted into the location, next to previously inserted
user.

Basically you'll have an empty sheet, you click on the button, a inputbox
asks for a username, the range gets copied in (if the sheet is still empty,
starting from cel A1). The following should get copied in at cel H4, next O4,
V4, AC4 so we get 5 users next to each other. After that we start a new row
of 5 users at A13 through AC13, and eventually the last row with 5 users
starting from A22, H22, O22, V22 and AC22. So now we have 15 users in a 3 x 5
setup.

The UserRange itself is a already made ready on another worksheet ("code"),
so i just copy that range to this worksheet, and i insert the correct
username.

I've been experimenting with Cells(..., ...).End etc... but without much
luck. Is what I am trying to do still doable? Or should i go for another
approach?

Any suggestions, tips or ideas....

Thanks in advance.

joel

Copying ranges to various locations
 
Everything you are asking for can be done. I think the prblem you are having
is the difference between cells (one cells) and range (multiple cells).

Here are some examples of cels and range

cells(Row,Column)
cells(1,1)
cells(1,"A")


set myrange = range("A1:C10")
set myrange = range(cells(firstrow,firstcolumn),cells(Lastrow,la stcolumn))

The cells in range can have the same format as individual cells

By setting a range you can use the range name instead of using range

range("A1:C10").select
myrange.select


"Memento" wrote:

Ok guys,

I'm struggeling a while already with this one,

I have 15 ranges with a medium size. At first the worksheet is empty, and
there's a button on it "New user". Basically the idea is when a new user is
introduced, one could hit the button, give the name of the user, and the
range "UserRange" gets pasted into the location, next to previously inserted
user.

Basically you'll have an empty sheet, you click on the button, a inputbox
asks for a username, the range gets copied in (if the sheet is still empty,
starting from cel A1). The following should get copied in at cel H4, next O4,
V4, AC4 so we get 5 users next to each other. After that we start a new row
of 5 users at A13 through AC13, and eventually the last row with 5 users
starting from A22, H22, O22, V22 and AC22. So now we have 15 users in a 3 x 5
setup.

The UserRange itself is a already made ready on another worksheet ("code"),
so i just copy that range to this worksheet, and i insert the correct
username.

I've been experimenting with Cells(..., ...).End etc... but without much
luck. Is what I am trying to do still doable? Or should i go for another
approach?

Any suggestions, tips or ideas....

Thanks in advance.



All times are GMT +1. The time now is 04:20 AM.

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