PC Review


Reply
Thread Tools Rate Thread

Copying Sheet1 to Sheet2 in a certain pattern

 
 
BEE
Guest
Posts: n/a
 
      6th Dec 2008
I have 2 Worksheets Sheet1 and Sheet2.

Sheet2 contains the raw data and Sheet1 is the raw data arranged in specific
requirement.

I have all this formula =IF('Sheet2'!A1="","",'Sheet2'!A1) on every cells
from A1 to D50000

I am copying Sheet2 Cells A1,A2,A3,B1,B2,B3 to Sheet1

A1 is Name1
A2 is Date/Time
A3 is Name2
B1 is Value1
B2 is Value2
B3 is Result.

Copy to Sheet1
A1 is Sheet2.Name1
A2 is Sheet2.Value1
A3 is Sheet2.Value2
A4 is Sheet2.Date/Time

What I did is manually key in the formula in every cells on Sheet1.

May I know how can i do it using a marco.

 
Reply With Quote
 
 
 
 
Otto Moehrbach
Guest
Posts: n/a
 
      6th Dec 2008
BEE
What you say is not clear. You say that you have that formula in each
of 50000 cells. Why? Do you want Sheet1 to display every one of those
50000 cells from Sheet2? You say you are copying 6 cells and you give the
addresses of those 6 cells in Sheet2. But then you give only 4 destination
cells in Sheet1. What happened to the other two cell values?
You say that you want to copy the data "arranged in specific requirement."
Is there a pattern to what you want that repeats? If so, provide specific
cell addresses that you want copied to specific cell addresses for at least
2 repeats of the pattern. HTH Otto

"BEE" <(E-Mail Removed)> wrote in message
news:A1688658-C1FF-42DE-9D36-(E-Mail Removed)...
>I have 2 Worksheets Sheet1 and Sheet2.
>
> Sheet2 contains the raw data and Sheet1 is the raw data arranged in
> specific
> requirement.
>
> I have all this formula =IF('Sheet2'!A1="","",'Sheet2'!A1) on every cells
> from A1 to D50000
>
> I am copying Sheet2 Cells A1,A2,A3,B1,B2,B3 to Sheet1
>
> A1 is Name1
> A2 is Date/Time
> A3 is Name2
> B1 is Value1
> B2 is Value2
> B3 is Result.
>
> Copy to Sheet1
> A1 is Sheet2.Name1
> A2 is Sheet2.Value1
> A3 is Sheet2.Value2
> A4 is Sheet2.Date/Time
>
> What I did is manually key in the formula in every cells on Sheet1.
>
> May I know how can i do it using a marco.
>



 
Reply With Quote
 
BEE
Guest
Posts: n/a
 
      7th Dec 2008
What you say is not clear.
>Sorry for the confusion.


You say that you have that formula in each of 50000 cells. Why? Do you
want Sheet1 to display every one of those 50000 cells from Sheet2?
>Yes. Basically is all data of sheet2 to sheet1 in a specific arrangement.


You say you are copying 6 cells and you give the addresses of those 6 cells
in Sheet2. But then you give only 4 destination cells in Sheet1. What
happened to the other two cell values?
> Forgot to state.


You say that you want to copy the data "arranged in specific requirement."
Is there a pattern to what you want that repeats? If so, provide specific
cell addresses that you want copied to specific cell addresses for at least
2 repeats of the pattern

Sheet2
A1(Name1) B1(Date/Time) C1(Name2)
A2(Value1)B2(Value2) C2(Result)
A3(Name1) B3(Date/Time) C3(Name2)
A4(Value1)B4(Value2) C4(Result)

Sheet1
A1(Name1)A2(Value1)B2(Value2)B1(Date/Time)C1(Name2)C2(Result)
A3(Name1)A4(Value1)B4(Value2)B3(Date/Time)C3(Name2)C4(Result)
 
Reply With Quote
 
Otto Moehrbach
Guest
Posts: n/a
 
      7th Dec 2008
BEE
This little macro should work for you. I named the source sheet "Source"
and the destination sheet "Destination". Note that both sheet names are in
the macro. Change these names as needed. HTH Otto
Sub ReArrange()
Dim rColA As Range
Dim ACell As Range
Dim Dest As Range
Sheets("Source").Select
Set ACell = Range("A1")
Set Dest = Sheets("Destination").Range("A1")
Do
ACell.Copy Dest
ACell.Offset(1).Copy Dest.Offset(, 1)
ACell.Offset(1, 1).Copy Dest.Offset(, 2)
ACell.Offset(, 1).Copy Dest.Offset(, 3)
ACell.Offset(, 2).Copy Dest.Offset(, 4)
ACell.Offset(1, 2).Copy Dest.Offset(, 5)
Set Dest = Dest.Offset(1)
Set ACell = ACell.Offset(2)
Loop Until IsEmpty(ACell.Value)
End Sub
"BEE" <(E-Mail Removed)> wrote in message
news:219B005B-72C6-4DBA-9C53-(E-Mail Removed)...
> What you say is not clear.
>>Sorry for the confusion.

>
> You say that you have that formula in each of 50000 cells. Why? Do you
> want Sheet1 to display every one of those 50000 cells from Sheet2?
>>Yes. Basically is all data of sheet2 to sheet1 in a specific arrangement.

>
> You say you are copying 6 cells and you give the addresses of those 6
> cells
> in Sheet2. But then you give only 4 destination cells in Sheet1. What
> happened to the other two cell values?
>> Forgot to state.

>
> You say that you want to copy the data "arranged in specific requirement."
> Is there a pattern to what you want that repeats? If so, provide specific
> cell addresses that you want copied to specific cell addresses for at
> least
> 2 repeats of the pattern
>
> Sheet2
> A1(Name1) B1(Date/Time) C1(Name2)
> A2(Value1)B2(Value2) C2(Result)
> A3(Name1) B3(Date/Time) C3(Name2)
> A4(Value1)B4(Value2) C4(Result)
>
> Sheet1
> A1(Name1)A2(Value1)B2(Value2)B1(Date/Time)C1(Name2)C2(Result)
> A3(Name1)A4(Value1)B4(Value2)B3(Date/Time)C3(Name2)C4(Result)



 
Reply With Quote
 
BEE
Guest
Posts: n/a
 
      8th Dec 2008
I have tried the code and the PC hangs that I need to restart the PC.
 
Reply With Quote
 
Otto Moehrbach
Guest
Posts: n/a
 
      8th Dec 2008
BEE
It works for me. Where did you put the macro (what module)? What
version of Excel are you using (I have 2002)? What is your macro security
setting (Tools - Macro - Macro Security)? HTH Otto
"BEE" <(E-Mail Removed)> wrote in message
news:6DD5682D-1BF5-4C2C-BC5C-(E-Mail Removed)...
>I have tried the code and the PC hangs that I need to restart the PC.



 
Reply With Quote
 
BEE
Guest
Posts: n/a
 
      10th Dec 2008
Thank you for your response.

It works for me. Where did you put the macro (what module)?
I paste in in
-In the Sheet1 worksheet.


What version of Excel are you using (I have 2002)?
-I am using 2003

What is your macro security setting (Tools - Macro - Macro Security)?
-Low
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A1 Sheet2 is linked to A1 sheet1 so that user enters value(abc123) a1 sheet1 and A1 sheet2 is updated pano Microsoft Excel Programming 2 28th Oct 2007 02:32 PM
copying data from sheet1 to sheet2 Rookie Microsoft Excel Worksheet Functions 6 7th Sep 2006 12:09 PM
Copying records from sheet1 to sheet2?? j2dizzo Microsoft Excel Programming 9 6th Dec 2005 03:29 PM
Copying Cells from Sheet2 to sheet1 Gary Microsoft Excel Programming 1 16th Apr 2004 09:10 AM
Copying everything from a cell in Sheet1 to Sheet2 =?Utf-8?B?UmF4ZXI=?= Microsoft Excel Misc 4 28th Dec 2003 05:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:34 AM.