Excel EXCEL HELP! Need to copy cell into the same worksheet name


Joined
Aug 14, 2012
Messages
5
Reaction score
0
Hi I need help!
I have a mani worksheet called "Main"
then i have other workseets called "1,2,3,4,5"

In main sheet i have cells A2,A3 and a4 listing values "orange", "1", "date"

I need a macro code that will copy the cells A2 to A4 into another worksheet that will match A3 value, and then go back to "Main" sheet and delete it there

in other sheets, "1", or "2" or "3" and so on it would form the data that you can keep entering in the main sheet, but it would go into appropriate worksheet after and be deleted from the main sheet so you can keep entering it...

So every time you enter say "orange" "1" "5/5/20012" it'll go into worksheet "1" and paste that data into table, and go back to main sheet...

HELPP PLEASEEEEEE:blush:
 
Ad

Advertisements

Joined
Mar 20, 2012
Messages
764
Reaction score
4
I will just give you a heads up that this isn't a simple question, and it might take more than a day for you to get an answer. Good luck!

Also, the whining isn't becoming of you, you shouldn't continue with that. ;)
 
Joined
Mar 20, 2012
Messages
764
Reaction score
4
Not to sure where you are located, but our MS Ofice experts are in the US of A, so might take time for them to answer :D


I'd like to consider myself one of those, and I can say that this will take someone who is very good with VBA. There's not a formula that can do what the OP wants to do, in that way. As I said earlier, good luck! (Also, it's 7:30 PM here on the east coast of the US, so if someone knows something, they should be on either tonight, if not you'll have to wait at least another 14 hours or so).
 
Joined
Aug 14, 2012
Messages
5
Reaction score
0
That's ok! Thank you Sooo Soo much for some feedback!!!
I'm trying to learn the program on my own and it's not that easy .. Thank you so much everyone once again, I'll be patiently waiting if anybody can help even a little bit! ;))
 
Ad

Advertisements

Joined
Aug 14, 2012
Messages
5
Reaction score
0
Sub copyRng()
Dim sh1 As Worksheet, rng As Range, lc As Long
Set sh1 = Sheets("MAIN")
Set rng = sh1.Range("C7:G7")
For Each sh In ThisWorkbook.Sheets
If sh.Name = sh1.Range("E7").Value Then
lc = sh.Cells(2, Columns.Count).End(xlToLeft).Columns
rng.Copy sh1.Cells(2, lc + 1)
End If
Next
End Sub


It gives me an error at the rng.copy sh1.cells(2, lc+1)...
can't figure it out... :(
 
Ad

Advertisements

Joined
Aug 14, 2012
Messages
5
Reaction score
0
Figured it out... for anybody else that has a similar problem here it is! Thank you all for comments!

Sub copyRng()
Dim sh1 As Worksheet, rng As Range, lr As Long, lc As Long
Set sh1 = Sheets("MAIN")
Set rng = sh1.Range("C7:G7")
For Each sh In ActiveWorkbook.Sheets
If sh.Name = sh1.Range("E7").Value Then
[sh].Activate
lr = Range("A" & Rows.Count).End(xlUp).Row
[rng].Copy Destination:=[sh].Range("A" & lr + 1)
[rng].ClearContents
End If
Next
[sh1].Activate
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top