Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Select Listindex from column A on selected row

Hi All:

I am putting an edit data procedure together. User enters data on
userform (UserNewEntry), calculates some risk metrics, and an output
spreadsheet is populated with inputs and calculated outputs.

The project unique ID (from the output data) populates the first
userform combobox dropdown. The user can select a pre-existing project
(populating all userform controls from the output sheet) and user can
edit inputs from the userform. The user can also enter in a new
project in cboProjectTitle.

So that the user can edit the project directly from the output sheet, I
would like to give them the capability to select any value on a
particular project row and call the userform populated with that data
so that the risk calculations can be redone.

Here's what I have done: The output sheet has a commandbar with an
edit button and a new project button. I would like the edit button to
select the value in column A on the selected row, populate the
cboProjectTitle with that value thereby populating all controls with
the input data on the selected row (seperate module). Clearly, the new
entry button would call the userform deaulted to blank (the user can
still select a pre-existing project from cboProjectTitle.

My code is pretty lengthy. But the relevant portion should, in basic
form, look something like this:
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
'Commandbar procedure
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
Sub CreateToolbar()
Dim RRTools As CommandBar
Dim bSave As CommandBarButton
Dim bEdit As CommandBarButton

On Error Resume Next
CommandBars("RR Field Tools").Delete
On Error GoTo 0

Set RRTools = CommandBars.Add

With RRTools
.Name = "RR Field Tools"
.Position = msoBarFloating
' .Protection = msoBarNoCustomize+msoBarNoResize
.Visible = True
End With

Set bSave = CommandBars("RR Field
Tools").Controls.Add(Type:=msoControlButton)
With bSave
.FaceId = 3
.OnAction = "SaveButton"
.Caption = "Save Locally"
End With

Set bEdit = CommandBars("RR Field
Tools").Controls.Add(Type:=msoControlButton)
With bEdit
.FaceId = 2946
.OnAction = "EditButton"
.Caption = "Edit Current Selection"
End With


End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
'Button procedures
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
Sub SaveButton()
On Error Resume Next
ActiveWorkbook.SaveAs Filename:="S:\LDC-LI\Risk\Risk Registry Field
Model\" & "RiskField." & Environ("username") & "." & Month(Now), _
FileFormat:=xlWorkbookNormal, CreateBackup:=True,
accessmode:=xlExclusive
On Error GoTo 0
End Sub

Sub EditButton()
Dim selectrow as range
On Error Resume Next
Set PTitleRow = ActiveCell.End(xlToLeft).Select
Load UserNewEntry
UserNewEntry.cboProjectTitle.Listindex=PTitleRow
Show UserNewEntry
On Error GoTo 0
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''

The userform comes up, but unpopulated. Any help/feedback is much
appreciated.

Cheers,
James KD

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Select Listindex from column A on selected row

First, I don't have a guess.

But I think you're masking any error by including "On Error Resume Next" in that
"EditButton" routine.

I'd comment out that line (or remove it and make sure bad things can't happen)
and do some testing.



KD wrote:

Hi All:

I am putting an edit data procedure together. User enters data on
userform (UserNewEntry), calculates some risk metrics, and an output
spreadsheet is populated with inputs and calculated outputs.

The project unique ID (from the output data) populates the first
userform combobox dropdown. The user can select a pre-existing project
(populating all userform controls from the output sheet) and user can
edit inputs from the userform. The user can also enter in a new
project in cboProjectTitle.

So that the user can edit the project directly from the output sheet, I
would like to give them the capability to select any value on a
particular project row and call the userform populated with that data
so that the risk calculations can be redone.

Here's what I have done: The output sheet has a commandbar with an
edit button and a new project button. I would like the edit button to
select the value in column A on the selected row, populate the
cboProjectTitle with that value thereby populating all controls with
the input data on the selected row (seperate module). Clearly, the new
entry button would call the userform deaulted to blank (the user can
still select a pre-existing project from cboProjectTitle.

My code is pretty lengthy. But the relevant portion should, in basic
form, look something like this:
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
'Commandbar procedure
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
Sub CreateToolbar()
Dim RRTools As CommandBar
Dim bSave As CommandBarButton
Dim bEdit As CommandBarButton

On Error Resume Next
CommandBars("RR Field Tools").Delete
On Error GoTo 0

Set RRTools = CommandBars.Add

With RRTools
.Name = "RR Field Tools"
.Position = msoBarFloating
' .Protection = msoBarNoCustomize+msoBarNoResize
.Visible = True
End With

Set bSave = CommandBars("RR Field
Tools").Controls.Add(Type:=msoControlButton)
With bSave
.FaceId = 3
.OnAction = "SaveButton"
.Caption = "Save Locally"
End With

Set bEdit = CommandBars("RR Field
Tools").Controls.Add(Type:=msoControlButton)
With bEdit
.FaceId = 2946
.OnAction = "EditButton"
.Caption = "Edit Current Selection"
End With

End Sub

'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
'Button procedures
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''
Sub SaveButton()
On Error Resume Next
ActiveWorkbook.SaveAs Filename:="S:\LDC-LI\Risk\Risk Registry Field
Model\" & "RiskField." & Environ("username") & "." & Month(Now), _
FileFormat:=xlWorkbookNormal, CreateBackup:=True,
accessmode:=xlExclusive
On Error GoTo 0
End Sub

Sub EditButton()
Dim selectrow as range
On Error Resume Next
Set PTitleRow = ActiveCell.End(xlToLeft).Select
Load UserNewEntry
UserNewEntry.cboProjectTitle.Listindex=PTitleRow
Show UserNewEntry
On Error GoTo 0
End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''

The userform comes up, but unpopulated. Any help/feedback is much
appreciated.

Cheers,
James KD


--

Dave Peterson
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
when I select one cell, why are 5 more cells selected below Mrnetwurm Excel Discussion (Misc queries) 3 August 19th 09 11:15 PM
List to select up to 6 selected responses Ellen Excel Discussion (Misc queries) 4 May 12th 07 05:20 PM
Select the last Cell of a selected Cellarea Ben Excel Programming 4 June 22nd 05 01:35 PM
Can you select a chart but not see it's selected? Mark Stephens Charts and Charting in Excel 1 May 8th 05 08:17 AM
How do I de-select a selected row? Suze Excel Discussion (Misc queries) 1 April 25th 05 05:10 PM


All times are GMT +1. The time now is 05:54 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"