LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default Urgent,! Need help with this 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("Numb*er 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").clearcont*ents
shtEM.Range("B10:C13").clearco*ntents
shtPA.Range("B33:AO44").clearc*ontents
shtPA.Range("B66:AO76").clearc*ontents
'shtNCS.Range("A3:H1000").clea*rcontents
shtResults.Range("A3:AR65536")*.clearcontents
shtNPCJ.Range("B10:C13").clear*contents
intResultRow = 3


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


Application.ScreenUpdating = False
Worksheets.Add after:=Worksheets(Worksheets.C*ount)
NewSheet = ActiveSheet.Name
With Worksheets(NewSheet)
.Move after:=Worksheets(Worksheets.C*ount)
.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").Va*lue
Sheets("NEW CHORD SIZES").Cells(R, 7).Value =
Sheets(strMark).Range("E2").Va*lue


Exit For


Next
Next

 
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
MACRO URGENT HELP OSK Excel Discussion (Misc queries) 2 June 29th 07 09:08 PM
Urgent - Help VBA Macro Jeff Excel Discussion (Misc queries) 8 October 3rd 05 08:25 PM
Urgent Macro help needed ! sameer27p[_6_] Excel Programming 2 July 19th 04 09:02 PM
Macro help urgent urgent Dave Peterson[_3_] Excel Programming 0 September 4th 03 03:59 PM
Macro help urgent urgent chandra Excel Programming 0 September 4th 03 03:50 PM


All times are GMT +1. The time now is 06:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"