Solved

Excel Userform Initialize

Posted on 2015-01-20
5
213 Views
Last Modified: 2015-01-20
The attached spreadsheet has a Userform that allows the User to scroll through the rows of data in the spreadsheet.

Trying to figure out how to have the user double click in a "Sub-System" cell (Column C) and have the Userform open to that row data. Currently the Userform opens to the first record, and the user has to scroll through rows to reach the row in question.
Tracker-Workbook.xlsm
0
Comment
Question by:DougDodge
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40560705
An example could be like below:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

Set Rng = Range("C6:C" & Lastrow)

If Not Intersect(Target, Rng) Is Nothing Then SubSystemDetail.Show

End Sub

Open in new window



If you want to be able to type in the cell with the Form open also, you use VbModeless:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, 

Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

Set Rng = Range("C1:C" & Lastrow)

If Not Intersect(Target, Rng) Is Nothing Then SubSystemDetail.Show VbModeless
End Sub

Open in new window

0
 

Author Comment

by:DougDodge
ID: 40560766
Double click opens the Userform, but it does not open it to the item that was double clicked on, it just opens the Userform.
0
 
LVL 11

Accepted Solution

by:
Wilder1626 earned 500 total points
ID: 40560851
If you want to see a value from a cell in the userform, you can do this. example
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

SubSystemDetail.txtSubSystem = Cells(Application.ActiveCell.Row, 3).Value
    SubSystemDetail.Show

End Sub

Open in new window


That would enter the value from the C column Cell into the txtSubSystem  textbox

You can put has many textbox as you needs
Ex:
SubSystemDetail.TexBox1= Cells(Application.ActiveCell.Row, 3).Value

SubSystemDetail.TexBox2= Cells(Application.ActiveCell.Row, 4).Value

Open in new window

0
 

Author Closing Comment

by:DougDodge
ID: 40560963
Works like a charm.....

Thanks.....
0
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40560973
i'm glad i was able to help.
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
: Microsoft Office Collaborate for free and online versions of Microsoft  Word, Excel, Powerpoint, OneNote, Onedrive , Email, Calendar etc. In short we can say that Microsoft office is a suite of servers, applications and services developed by  Micr…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question