Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Still working on complex code


In the following code I have my been able to complete the following
task:

my userform will
- add the name entered on it to the selected cells in the activate
worksheet (A).
- add the name entered into the userform to the title of a new
worksheet (B) tab
- and it will copy the contents of another worksheet to the worksheet
(B)

This is great I am so close to completing my goal.

Now, I need to have:

- the name of the worksheet (B) added to a cell in worksheet (B)
- and I want to be able to have the contents of the entire row created
in worksheet (A) that shares the name of worksheet (B) be copied over
to certain cells in worksheet (B) as they are added to worksheet (A).

So for example:

If I enter John Brown into my userform it will create a row entry in
worksheet (A) that says John Brown and it will create worksheet (B)
that has the title John Brown and I want to have the name John Brown
appear in cell A1 in worksheet (B), then I want to be able to add data
to worksheet (A) and have that data fill-in and create cell info from
worksheet (A) to worksheet (B) of the same name.

current code

Code:
--------------------

Private Sub cmdAdd_Click()
Dim iRow As Long
Dim ws As Worksheet
Dim newSheetName As String
Set ws = Worksheets("Class GradeSheet")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
.End(xlUp).Offset(1, 0).Row

'check for a part number
If Trim(Me.TextBox56.Value) = "" Then
Me.TextBox56.SetFocus
MsgBox "Please enter last name"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 1).Value = Me.TextBox56.Value
ws.Cells(iRow, 2).Value = Me.TextBox55.Value
newSheetName = ws.Cells(iRow, 1) & "," & ws.Cells(iRow, 2)

'clear the data
Me.TextBox56.Value = ""
Me.TextBox55.Value = ""
Me.TextBox56.SetFocus

For Each ws In Worksheets
If ws.Name = newSheetName Or _
newSheetName = "" Or _
IsNumeric(newSheetName) Then
MsgBox "Sheet already exists or name is invalid", vbInformation
Exit Sub
End If

Next
Sheets("Student Sheet").Copy befo=Sheets(1)
Sheets(1).Name = newSheetName
Sheets(newSheetName).Move After:=Sheets(Sheets.Count)

'close userform
Unload Me
End Sub

--------------------


--
oberon.black
------------------------------------------------------------------------
oberon.black's Profile: http://www.excelforum.com/member.php...o&userid=26732
View this thread: http://www.excelforum.com/showthread...hreadid=401531

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Still working on complex code


Which bit doesn't work? It's very complicated to follow. Maybe give a
indication of what you can't get to work

--
gearo
-----------------------------------------------------------------------
gearoi's Profile: http://www.excelforum.com/member.php...fo&userid=2657
View this thread: http://www.excelforum.com/showthread.php?threadid=40153

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
complex color fill conditions- if statements or complex formula? lilly8008 Excel Discussion (Misc queries) 1 December 18th 09 04:57 AM
complex index function not working mmcap Excel Worksheet Functions 7 April 3rd 09 05:07 AM
Code not working Todd Huttenstine Excel Programming 1 June 10th 04 05:06 PM
Do---Loop Error in Complex Code Pete T[_2_] Excel Programming 5 October 14th 03 06:54 PM
For Each Code Not Working jacqui[_2_] Excel Programming 4 July 29th 03 02:44 AM


All times are GMT +1. The time now is 10:41 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"