excel marco
Copy these two code blocks into a standard module:
Sub Foo()
Dim Temp As String
If ActiveCell = Range("a1") Then
Temp = Range("A1").Value
If SheetExists(Temp) Then
Range("A1").Copy Destination:=Sheets(Temp).Range("A1")
Else
Worksheets.Add(After:=Sheets(Sheets.Count)).Name = Temp
Range("A1").Value = Temp
End If
End If
End Sub
Private Function SheetExists(sname) As Boolean
' Returns TRUE if sheet exists in the active workbook
Dim x As Object
On Error Resume Next
Set x = ActiveWorkbook.Sheets(sname)
If Err = 0 Then SheetExists = True _
Else SheetExists = False
End Function
In sheet1 - cell A1 enter jkuck
Run macro Foo
Hope this helps,
Jim May
" wrote in message
ups.com:
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
|