PC Review


Reply
Thread Tools Rate Thread

Copy different cells from Datawrksht to wrksht1 and wrksht2

 
 
Memphis
Guest
Posts: n/a
 
      19th Feb 2009
Hello,
I would like to copy cell values from Datawrksht to other worksheets by
clicking one button.
Like this:
Select A1 from Datawrksht and copy the value (not the formating) to cell C9
on Worksheet1, then select B1 from Datawrksht and copy the value to cell c10
in Worksheet2, Now, I will have to repeat this over and over later to select
many other cells that have to be copied to different sheets.
Here is the complication, once it is done copying and pasting, I would like
it to Delete Datawrksht and to open up the SAVE AS dialog box so that I can
save this as a new file.

Regards

Memphis
 
Reply With Quote
 
 
 
 
dan dungan
Guest
Posts: n/a
 
      19th Feb 2009
Hi Memphis,

When you "repeat this over and over later to select
many other cells that have to be copied to different sheets. . ."

1. Are you always using A1 from Datawrksht and C9 on Worksheet1
and B1 from Datawrksht and c10 in Worksheet2?

2. How do you know to repeat this several times?

3. What is the difference between 1 and 2 and
. . .many other cells that have to be copied to different
sheets.. .?


Dan

 
Reply With Quote
 
Memphis
Guest
Posts: n/a
 
      20th Feb 2009
Ok, here it is.
I merged data from ACCES and dropped it into Dataworksheet, each row goes
from A1 trough CB1
So, I need to select cells within this row and paste them onto different
worksheets that need to capture information such as name, bank account,
address, payment amount, etc.. So each worksheet is for a different
information category which needs to be extracted from row1 in Dataworksheet.
Basically, this is to show the current information we have about the case.

Each row in Dataworksheet is info for a different case.

Then I need to create a file after I paste the info from Dataworksheet.

Yes the receiving cells in worksheet1 are scattered, they are not like
a1:c1, name goes in A1, SSN goes in B2, etc...

NOw, to save code, I would like to delete row A1 from Dataworksheet, thus
bumping row A2 and next time I run the code, this will refer to row A1 again,
but this row will obviously have info about another case.

A bit winded, but I hope you get the idea as to what I need to do.

Thank you




"dan dungan" wrote:

> Hi Memphis,
>
> When you "repeat this over and over later to select
> many other cells that have to be copied to different sheets. . ."
>
> 1. Are you always using A1 from Datawrksht and C9 on Worksheet1
> and B1 from Datawrksht and c10 in Worksheet2?
>
> 2. How do you know to repeat this several times?
>
> 3. What is the difference between 1 and 2 and
> . . .many other cells that have to be copied to different
> sheets.. .?
>
>
> Dan
>
>

 
Reply With Quote
 
dan dungan
Guest
Posts: n/a
 
      20th Feb 2009
Hi Memphis,

What stops you from using queries and reports in access?

Dan
 
Reply With Quote
 
Memphis
Guest
Posts: n/a
 
      25th Feb 2009
Thank you mdmckillop for the code, it allowed me to see that what I want to
do is possible.
I have come to realize that when I run this code, the cells I copy from
Sheet2 are then pasted over to sheets 3 and 4 as intended, but when this
happens they get rid of the cells borders that exist in Sheets 3 and 4. Also
some of the cells I am pasting the copied cells into are merged cells, so I
get an error " RUN TIME ERROR '1004':
Cannot Change Part of Merged Cell"
I would like to keep my merged cells and the existing borders in sheets 3
and 4.

Here is the code I have, i have four sheets 1 through 4 sheet one houses the
cmd button only, sheet 2 houses the case information, sheets 3 and 4 receive
the information found in sheet 2.
_____________________________________________
Private Sub CopyData_Click()
Dim Ax(3, 2)
Dim Bx(5, 4)

Dim i As Long
Dim Xi As Long

'Source Target
Ax(1, 1) = "A2": Ax(1, 2) = "B3"
Ax(2, 1) = "B2": Ax(2, 2) = "B5"
Ax(3, 1) = "C2": Ax(3, 2) = "B8"
'Source Target
Bx(4, 3) = "F2": Bx(4, 4) = "B4"
Bx(5, 3) = "G2": Bx(5, 4) = "B6"

For i = 1 To 3
For Xi = 4 To 5

Sheets("Sheet2").Range(Ax(i, 1)).Copy Sheets("Sheet3").Range(Ax(i, 2))
Sheets("Sheet2").Range(Bx(Xi, 3)).Copy Sheets("Sheet4").Range(Bx(Xi, 4))
Next
Sheets("Sheet3").Select
Next
Sheets("Sheet4").Select

Sheets(Array("Sheet3", "Sheet4")).Copy

'ActiveWorkbook.SaveAs ("C:\AAA\BogusFileName.xls")
'ActiveWorkbook.Close
End Sub
______________________________________________________

Thank you for your help in advance.

Memphis

 
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
copy an intial cells contents into the next series of blank cells ina column freeriderxlt Microsoft Excel Discussion 2 25th Aug 2009 07:47 AM
Copy Source Cells to Destination Cells Only when a Change Occurs excel student Microsoft Excel Misc 2 13th Jul 2008 04:13 AM
macro needed to copy blocks of cells across to list of cells down =?Utf-8?B?cGllcnNvbnBybw==?= Microsoft Excel Programming 3 28th Mar 2007 12:51 PM
How can I copy the values of all selected cells to the same cells inanother Sheet hans.domian@de.man-mn.com Microsoft Excel Programming 2 8th Aug 2006 05:45 PM
How to use macros to copy a range of cells which can exclude some cells which I didn't want to be copied? excelnovice Microsoft Excel Worksheet Functions 2 25th Sep 2005 12:38 AM


Features
 

Advertising
 

Newsgroups
 


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