Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Is This Possible?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Is This Possible?

Hard to tell since one would have to guess whether your variables are
properly assigned. There is no way to tell from the code you posted.

"Ayo" wrote:

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
Ayo Ayo is offline
external usenet poster
 
Posts: 489
Default Is This Possible?

Dim MAO_Value As String, rw_Index As Integer, cvRow As Integer, acRow As
Integer
Dim optProject As Control
Dim ProjectID As Variant, SiteID As Variant, TaskID As Variant
Set CVRange = Worksheets("CV Table").Range("A:S").Cells
Set ARange = Worksheets("Actuals Table").Range("A:N").Cells
Set maoRange = Worksheets("MAO Description").Range("A:B").Cells
Worksheets("Report").Activate

For Each optProject In fraProject.Controls
If optProject.Enabled = True And optProject.Value = True Then
ProjectID = Mid(optProject.Name, 4, 6)
End If
Next optProject

If frmReport.cboSiteID.Value < "" Then
SiteID = frmReport.cboSiteID.Value
End If

For Each c In Worksheets("Key").Range("B:B").Cells
If IsNull(frmReport.txtTask.Value) Then
If c.Value = SiteID And c.Offset(0, -1).Value = ProjectID Then
TaskID = c.Offset(0, 1).Value
frmReport.txtTask.Value = TaskID
Exit For
End If
ElseIf Not IsNull(frmReport.txtTask.Value) Then
Exit For
End If
Next

ActiveSheet.Range("B1").Value = SiteID
ActiveSheet.Range("G1").Value = ProjectID
ActiveSheet.Range("I1").Value = TaskID
ActiveSheet.Range("K1").Value = Date

ActiveSheet.Range("I1").numberFormat = "0000"
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 = "0"
End If

"JLGWhiz" wrote:

Hard to tell since one would have to guess whether your variables are
properly assigned. There is no way to tell from the code you posted.

"Ayo" wrote:

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

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



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