excel marco
so sheet 1234 would eventually end up with a bunch of cells containing 1234
Right click on the sheet tab where you will enter data in cell A1 and select
view code. Paste in code like this:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim sh as Worksheet, rng as Range
If Target.Address = "$A$1" then
on Error resume Next
set sh = worksheets(Target.value)
On error goto 0
if not sh is nothing then
if sh.Name = me.Name then exit sub
set rng = sh.Cells(rows.count,1).End(xlup)(2)
rng.value = target.value
on Error goto ErrHandler
Application.EnableEvents = False
Target.ClearContents
end if
end if
ErrHandler:
Application.EnableEvents = True
End Sub
Adapt to suit your real needs.
--
Regards,
Tom Ogilvy
" wrote:
I need to be able to enter data in one cell and run a macro where
excel would move that data to a worksheet of the same name.
Example: enter 1234 into cell A1. run macro. Cell A1 contents are
transferred to worksheet 1234
|