Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 274
Default Why doesn't this work

Hi All,

Below is the code l am using in a ComboBox. The form populates fine,
the 1st column being the combobox from which the user selects the
data. Text boxes are used to display the associated data in columns 2,
3 & 4. My requirement is then that the data in columns 2,3, 7 4 can be
edited and written back to the worksheet. With the code below only the
edited data in column 2 is written back!

Any help gratefully appreciated. This is driving me nuts.

Private Sub cbStaff_Change()
tbCat.Value = cbStaff.Column(1)
tbSkill.Value = cbStaff.Column(2)
tbNum.Value = cbStaff.Column(3)

End Sub

Private Sub cmdCancel_Click()
Unload frmStaffEdit
End Sub

Private Sub cmdOK_Click()
Dim r As Integer
r = cbStaff.ListIndex + 3
With Sheets("Staff List")
Cells(r, 3).Value = tbCat.Value
Cells(r, 4).Value = tbSkill.Value
Cells(r, 5).Value = tbNum.Value
End With
Unload frmStaffEdit
End Sub

Private Sub UserForm_Initialize()
cbStaff.Value = ""
End Sub



TIA

Regards

MB

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Why doesn't this work

I suspect you have those cells linked to to your combobox and you are getting
some interaction with that link. Suggest you break the link (rowsource)
and see how it works (load your combobox list with code).

--
Regards,
Tom Ogilvy


"michael.beckinsale" wrote:

Hi All,

Below is the code l am using in a ComboBox. The form populates fine,
the 1st column being the combobox from which the user selects the
data. Text boxes are used to display the associated data in columns 2,
3 & 4. My requirement is then that the data in columns 2,3, 7 4 can be
edited and written back to the worksheet. With the code below only the
edited data in column 2 is written back!

Any help gratefully appreciated. This is driving me nuts.

Private Sub cbStaff_Change()
tbCat.Value = cbStaff.Column(1)
tbSkill.Value = cbStaff.Column(2)
tbNum.Value = cbStaff.Column(3)

End Sub

Private Sub cmdCancel_Click()
Unload frmStaffEdit
End Sub

Private Sub cmdOK_Click()
Dim r As Integer
r = cbStaff.ListIndex + 3
With Sheets("Staff List")
Cells(r, 3).Value = tbCat.Value
Cells(r, 4).Value = tbSkill.Value
Cells(r, 5).Value = tbNum.Value
End With
Unload frmStaffEdit
End Sub

Private Sub UserForm_Initialize()
cbStaff.Value = ""
End Sub



TIA

Regards

MB


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
Macro to update a column in a work based on another work sheet WickerMan New Users to Excel 1 December 4th 09 12:58 PM
how can i automatically generate work order numbers from work orde rob h Excel Discussion (Misc queries) 1 July 13th 09 07:59 PM
If I have a work sheet protected and try to run a macro to hide rows or columns it won't work. Correct? Marc Excel Programming 2 July 12th 06 04:10 AM
Counting dates in multiple work sheets and work books Savage Excel Discussion (Misc queries) 0 December 19th 05 11:41 PM
Is there away to keep "auto save" from jumping to the first work sheet in the work book? Marc New Users to Excel 2 April 21st 05 01:27 AM


All times are GMT +1. The time now is 10:57 PM.

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

About Us

"It's about Microsoft Excel"