Highlight Cells and Auto copy to Existing Sheet

chaosisbliss

New Member
Joined
May 14, 2011
Messages
7
Hello,

I'm a newbie when it comes to Excel and VB so please keep this in mind :).

I want to copy the contents of any highlighted or copied cell into an existing w worksheet. By highlight I mean when I drag with my left mouse click or copied via ctrl-c only in column A. The information is on a sheet called "Morning" in column A, and I want this information automatically copied to worksheet "Query" on column A.

Any assistance would be greatly appreciated.

Thanks.
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Here is a quick little Macro

Sub test1()
Dim Str As String
Sheets("Query").Select
Range("A2").Select

Sheets("Morning").Select
For Each a In [A2:A200] '/////////////////
a.Cells.Select
If Selection.Interior.Color = "65535" Then
Sheets("Query").Select
Str = a.Cells.Value
ActiveCell.Value = Str
ActiveCell.Offset(1, 0).Select
End If

Sheets("Morning").Select
Next '/////////////////////////////////////

End Sub
 
Upvote 0
I figured I left something out. Otherwise it works great!

After the highlight, your Macro copies the information to the Query sheet. I forgot to say it has to copy the information back to back if that makes sense. Meaning it has to start with column A1 - A34 on the Query sheet with no skips in data.

Thanks again for you help. I really do appreciate it.
 
Upvote 0
Sorry for the confusion.

Yes, I need more help. When you run the macro you created, it copies but not in order.

Example:
We have data in A1 Morning and A3 Morning. There is no data in A2 Morning.

When A1 Morning cell is copied to the Query sheet it's coped to A1. But, if there is no data is A2 Morning cell it skips the cell and goes to A3 Morning cell and copies to A3 Query sheet. What will happen is the data is A3 Morning is copied to A3 Query instead of A2.

Man, I'm sorry. I don't know how else to explain it.
 
Upvote 0
That is factored in. The if statement looks for only if its highlighted and that activecell offset is in the if statement. If its not highlighted it could not copy and not offset. It works for me fine.

I must still be missing some thing.
 
Upvote 0

Forum statistics

Threads
1,224,612
Messages
6,179,890
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top