PDA

View Full Version : Print data from sheet to another one after one



Nader
12-30-2007, 07:11 AM
this code it will print the data from cells in sheet1 to cells in sheet2
If I try nwe data in the same cells in sheet1 it will print them in the same cells in sheet2 .
I want to print the new data that I inserted in the same cells in sheet1 belwo the last data with left a 3 rows between each new group data.


Dim myRange As Range
Dim j As Integer
Set myRange = Range("A6:A100")
j = 9
For i = 6 To myRange.Rows.Count
Sheets(2).Cells(j, 1).Value = Sheets(1).Cells(i, 1).Value
j = j + 1
Next i

lucas
12-30-2007, 08:59 AM
will sheet 1 be blank each time you do this?
The reason I ask is that if it won't be blank then how will excel know where to put the 3 row break?

Nader
12-30-2007, 09:42 AM
Yes it will be blank, but only sheet2 will left 3 rows between group data as it show in the pic

lucas
12-30-2007, 10:01 AM
This is not exactly what you asked for but very similar. It uses a userform and multiple textboxes to enter the data....You will have to add the necessary number of textboxes.

see attached.

Nader
12-31-2007, 06:07 AM
In the first thank you for help

I Tried this code but it give me 3 rwos break between each data not each group data as I want . s owhat si the mistake in the code




Dim myRange As Range

Dim j As Integer
Set myRange = Range("A6:A100")


For i = 6 To myRange.Rows.Count


Sheets(2).Cells(Rows.Count, 1).End(xlUp).Offset(4, 0).Value = Sheets(1).Cells(i, 1).Value
Next i

Aussiebear
12-31-2007, 07:47 PM
I Tried this code but it give me 3 rwos break between each data not each group data as I want . s owhat si the mistake in the code

How is the data group broken up? After all you asked ...


this code it will print the data from cells in sheet1 to cells in sheet2
If I try nwe data in the same cells in sheet1 it will print them in the same cells in sheet2 .
I want to print the new data that I inserted in the same cells in sheet1 belwo the last data with left a 3 rows between each new group data.

Nader
01-01-2008, 03:30 AM
Take a look to the pic above.The first data I wrote Jenny ... in sheet1 then press command it will print in sheet2 in group as it show in the pic then write another group data Jhon... and press command it will prin them below he last data with left 3 broken rows as it show in the pic

Nader
01-01-2008, 07:51 AM
here is the code, and it successed with me.


Dim myRange As Range
Dim j As Integer
Set myRange = Sheets(1).Range("A6:A100")
j = Sheets(2).UsedRange.Rows.Count + 3 + Sheets(2).UsedRange.Row
myRange.Copy Sheets(2).Range("f" & j)


How can I make this code start at sixth row of sheet2

Aussiebear
01-01-2008, 10:03 AM
As I understand it, your image has the names sorted into Male /Female name groups, is this right grouping? And it starts at row 9....

That aside, I would try counting the used rows from the bottom of Sheet two to find the first blank row and then offsetting this by three to find the startng point of the next set of data.

I'm confused with your wording in the last post. You said" here is the code, and it successed with me." Where did it place the data?

This line doesn't make sence at all " myRange.Copy Sheets(2).Range("f" & j)". Row positions start with a number not a alphabetical character.

Nader
01-01-2008, 04:30 PM
Here is the project after finishing.

Aussiebear
01-02-2008, 02:00 AM
Hmm..... we must be speaking two different languages here. You indicate one thing and mean something entirely different. What you have provided here as a finalised workbook, isn't what you initially asked for.

Nader
01-02-2008, 02:23 PM
Yes