The missing link

O

oberon.black

I have a workbook that will have lots of worksheets in it. I want to b
able to use one worksheet from the workbook to be able to updat
columns and rows of the other worksheets in the workbook.

I have created a macro in the master/main worksheet that will open
userform that will allow me to insert a clients name into it an the
that macro will place the clients name onto the spreadsheet and creat
a new worksheet with that clients name on it.

I want to be able to do two things:

Part I
I want the information that is in 'row 11' of the main/master pag
copied over to the worksheet with the username on it. So everytime
add some info to 'row 11' on the main/master worksheet that info wil
automatically be added to the worksheet with the usersname on it. B
the way the worksheet with the usersname is being created by the cop
of another worksheet and is simply being renamed.

Part II
I think this is going to be the tricky part. I want all of th
information from the 'row' on the main/master worksheet that has clien
name on it be added to the worksheet that has the same name as th
client. So if I have:
Jackson, Charles on row 15 of my main/master worksheet and a workshee
with the name Jackson, Charles I want to be able to type in the numbe
7 on the main/master worksheet on the same row as the nam
Jackson,Charles and have the number 7 appear on the worksheet with th
name Jackson, Charles.

with this code completed I would like for the spreadsheets to loo
something like this:

main/master
'row 11' nails apples blue things
night sun
Jackson, Charles 7 8 10 14
20 1

worksheet named Jackson, Charles
Nails 7
apples 8
blue 10
things 14
night 20
sun 1

This is the code I am using on the main/master to copy and create th
user worksheet

Code
-------------------

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

'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.LstNm.Value) = "" Then
Me.LstNm.SetFocus
MsgBox "Please enter last name"
Exit Sub
End If

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

'clear the data
Me.LstNm.Value = ""
Me.FrstNm.Value = ""
Me.LstNm.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("SS").Copy before:=Sheets(1)
Sheets(1).Name = newSheetName
Sheets(newSheetName).Move After:=Sheets(Sheets.Count)

'close userform
Unload Me
End Sub

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


I know that I have used alot of words but I know (think I know, but
know that I dont know) the code needed to do this is no that difficul
for someone versed in vba coding which I am not.

thanx
 

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

Similar Threads

Hyperlink Code 2
Add to CmdButton 0
Return to Main Page 1
Hide and Seek 4
cell references 0
Make a Better Userform 1
Debug - last leg of project 5
Runtime Error 1004:Method 'Range' of object'_Worksheet' Failed 4

Top