Thread: HUGE macro
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default HUGE macro

I'll take a look at this tonight. Usually these problems are when more that
one workbook is opened. the code is using Activeworkbook. Maybe this should
be changed to Thisworkbook (the book with the macro) rather than
actrtiveworkbook.

The other possibility it the range in the Pick_Um code doesn't specify a
worksheet. If D1 is 0 the code will not work (wrong workshet selected). You
are right the sort should be working which implies it is not reading the
value in D1 because the wrong worksheet is active.

Sub Pick_Um()

Select Case Range("D1").Value
Case 8
Call X_ON_X(4, 4)
Case 9
Call X_ON_X(5, 4)
Case 10
Call X_ON_X(5, 5)
Case 11
Call X_ON_X(6, 5)
Case 12
Call X_ON_X(6, 6)
Case 13
Call X_ON_X(7, 6)
Case 14
Call X_ON_X(7, 7)

End Select

End Sub

"project manager" wrote:

its not working at all??? its not sorting, copying or pasting???

i put a break in the first line and F8'ed it through...

just nothing



"joel" wrote:

I think in this case the select statement makes the code much easier to
understand. Reducing the number of lines of code really doesn't have any
advantage.

"Dana DeLouis" wrote:

Case 8
Call X_ON_X(4, 4)
Case 9
Call X_ON_X(5, 4)
Case 10
Call X_ON_X(5, 5)

Just an idea. If the op expands the number of inputs, does it follow
the same pattern?

x = CLng(Range("D1")) 'Make sure it's an integer
Select Case x
Case 8 To 14 ' or more...
Call X_ON_X((x + 1) \ 2, x \ 2)
Case Else
'??
End Select

= = =
Dana DeLouis

<snip