Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Userform options and macro

Hi All:

i would like your help with this macro.

I have created a userform, which i named "JOIST",with two options.

First option the user could select "ALL" to design all
marks(J1,J2,J3,..........) which are shown in column A. when some one
selects the option "ALL" on the userform, it puts in the word "ALL" in
shtWOOD.Cells(1, 2) which is cell"B2".

I have added an "if statement"

If shtWOOD.Cells(1, 2).Value = "ALL" Then
Nu = shtQDS.Range("BC1").Value

For some reason, despite cell B2 is showing the word "ALL",it does not
execute(SKIPS) the next statement after "Then" which is

Nu = shtQDS.Range("BC1").Value, where Nu is the number of all
marks(J1,J2,J3,....) that exist in column A.



how can i correct the code so that when some one select" ALL" in the
userform, to tell it
that" Nu" is equal to the value Nu = shtQDS.Range("BC1").Value


Second Option is for the user to "Select Mark", where he would type
the mark in the textbox next to that option, and then the program will
analyz that specific mark. The marks can be
(J1,J2,J3.....................*.).
that optin is not incorporated in the code which i also would like help
on.

Right now the program will analyze all the marks in that column. i just

would like to make it more flexible.


Ththe name of the userform is "JOIST".


I apprecaite any help!


This is part of the code :

Set shtQDS = ThisWorkbook.Sheets("QDS")
Set shtWOOD = ThisWorkbook.Sheets("Wood Info")
Set shtEM = ThisWorkbook.Sheets("Existing Material")
Set shtPA = ThisWorkbook.Sheets("Panel Analysis")
Set shtNCS = ThisWorkbook.Sheets("NEW CHORD SIZES")
Set shtAP = ThisWorkbook.Sheets("Angle Properties")
Set shtResults = ThisWorkbook.Sheets("Results")
Set shtNPCJ = ThisWorkbook.Sheets("New Partial Composite Joist")

'Get the mark
'Nu = Int(Application.InputBox("Number of Joist marks?"))
JOIST.Show
If shtWOOD.Cells(1, 2).Value = "ALL" Then
Nu = shtQDS.Range("BC1").Value
For Z = 1 To Nu Step 1
strMark = "J" & Z
End If
Application.ScreenUpdating = False
'Error check
'If strMark = "" Then
' MsgBox "No mark chosen. Analysis cancelled."
'GoTo CancelAnalysis
'End If

'Clear old data
shtEM.Range("B2:B9").clearcontents
shtEM.Range("B10:C13").clearcontents
shtPA.Range("B33:AO44").clearcontents
shtPA.Range("B66:AO76").clearcontents
'shtNCS.Range("A3:H1000").clearcontents
shtResults.Range("A3:AR65536").clearcontents
shtNPCJ.Range("B10:C13").clearcontents
intResultRow = 3

'Set initial values
i = 3
intLines = 0
intLoadCase = 1
boolCancel = False

Application.ScreenUpdating = False
Worksheets.Add after:=Worksheets(Worksheets.Count)
NewSheet = ActiveSheet.Name
With Worksheets(NewSheet)
.Move after:=Worksheets(Worksheets.Count)
.Name = strMark
.Activate
Columns("A:A").ColumnWidth = 51.14
Columns("B:AR").Select
Selection.ColumnWidth = 13
ActiveWindow.Zoom = 75
End With

'Find out how many load cases we're dealing with

Do
If shtQDS.Cells(i, 1).Value = strMark Then
If shtQDS.Cells(i, 4).Value intLoadCases Then intLoadCases =
shtQDS.Cells(i, 4).Value
End If
i = i + 1
Loop Until IsEmpty(shtQDS.Cells(i, 1))

i = 3

FindNext:

'Find valid row
Do
If shtQDS.Cells(i, 1).Value = strMark And shtQDS.Cells(i, 4).Value
= intLoadCase Then
GoTo GetValues
Else
i = i + 1
End If

Loop Until IsEmpty(shtQDS.Cells(i, 1))

'After no more valid rows for that load case, run optimization routine
Optimize

'Determine if any more load cases exist
If intLoadCase < intLoadCases Then
intLoadCase = intLoadCase + 1
i = 3
GoTo FindNext
End If

For R = 2 + Z To Nu + 3 Step 1
Sheets("NEW CHORD SIZES").Cells(R, 1).Value = strMark
Sheets("NEW CHORD SIZES").Cells(R, 2).Value = intQty
Sheets("NEW CHORD SIZES").Cells(R, 3).Value = dblLength
Sheets("NEW CHORD SIZES").Cells(R, 4).Value = intETCA
Sheets("NEW CHORD SIZES").Cells(R, 5).Value = intEBCA
Sheets("NEW CHORD SIZES").Cells(R, 6).Value =
Sheets(strMark).Range("D2").Value
Sheets("NEW CHORD SIZES").Cells(R, 7).Value =
Sheets(strMark).Range("E2").Value


Exit For

Next
Next

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
ProtectSheet Options are un-checking after macro Roady Excel Discussion (Misc queries) 9 November 16th 11 04:19 PM
Record Macro and Edit Macro options disabled Huzza New Users to Excel 1 March 18th 09 03:55 PM
A Sad Day... Macro Options Unavailable :( Maxemily Excel Discussion (Misc queries) 1 April 2nd 06 11:08 PM
How do I start solver options in a Macro? Kent Gambrel Excel Programming 2 February 14th 05 06:44 PM
Userform button options John Green[_2_] Excel Programming 0 July 18th 03 11:59 PM


All times are GMT +1. The time now is 02:29 AM.

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"