IS this possible?

A

Ayo

I have a form with option buttons, 1 combobox, 1 textbox and a few buttons.
What I am trying to do is to get a value and put it in the textbox based on
what is in the combobox and what is selected from the option button.
My problem is that when I select an option and input a value into the
combox, the text box is still empty. What am I doing wrong?

For Each optProject In fraProject.Controls
If optProject.Enabled = True And optProject.Value = True Then
ActiveSheet.Range("B1").Value = frmReport.cboSiteID.Value
ActiveSheet.Range("G1").Value = Mid(optProject.Name, 4, 6)
If Left(ActiveSheet.Range("G1").Value, 1) = 8 Then
ActiveSheet.Range("G1").numberFormat = "000000"
ElseIf Left(ActiveSheet.Range("G1").Value, 1) <> 8 Then
ActiveSheet.Range("G1").numberFormat = "00000"
End If
For Each c In Worksheets("Key").Range("B:B").Cells
If IsNull(frmReport.txtTask.Value) Then
If c.Value = frmReport.cboSiteID.Value Then
If c.Offset(0, -1).Value = Mid(optProject.Name, 4, 6) _
Or c.Offset(0, -1).Value = Mid(optProject.Name, 4,
5) Then
frmReport.txtTask.Value = c.Offset(0, 1).Value
Exit For
End If
End If
ElseIf Not IsNull(frmReport.txtTask.Value) Then
Exit For
End If
Next
ActiveSheet.Range("I1").Value = frmReport.txtTask.Value
ActiveSheet.Range("I1").numberFormat = "0000"
ActiveSheet.Range("K1").Value = Date
End If
Next optProject
 
S

Sue Mosher [MVP-Outlook]

ActiveSheet suggests that maybe you meant to post this in an Excel forum rather than an Outlook forum? When you post it in an Excel group, you might want to include information about the Excel version and what event handler or procedure is actually running this code.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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

Top