Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Inconsistent code

For fCtr = LBound(PrintFiles) To UBound(PrintFiles)
Set PrintFiles(fCtr) = Workbooks.Open _
(FileName:=PrintFileNames(fCtr))
Range("A1").Select
'If it's the first workbook in the loop, and if the user wants to
'hide the same Column(s):
If fCtr = 1 Then
If Global_HideSameCols = True Then
'On Error Resume Next
* Set Global_ExclColRng = Application.InputBox("Use the left mouse " & _
"button with the Control key," & vbNewLine & "to select at least"
_
& " one cell in each column " & vbNewLine & "(or the entire" _
& ".column), to indicate those" & vbNewLine & "Columns to be" _
& " hidden. Click OK. when done", Type:=8)
'On Error GoTo 0
End If
End If
'But user might still want to hide a Column(s) in individual workbooks,
so:
If HideCols = True Then
If Global_HideSameCols = False Then
'On Error Resume Next
* Set Wkbk_ExclColRng = Application.InputBox("This is a test",
Type:=8)

If I direct the code through the first Set statement and select a range
to hide, then the code executes ok. If I direct it through the second Set
statement, I get an 'Object required' message.

Why is the code not working, and why is it inconsistent, please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Inconsistent code

You get an error if the user hits cancel since the inputbox returns false
instead of a range you can't

set Global_ExclColRng = False

that is why the error handlers are there (you commented them out). They
catch the error and ignore it.

You then have to test the object to see if it was set

if Global_ExclColRng is nothing then
msgbox "You clicked cancel"
End if

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
For fCtr = LBound(PrintFiles) To UBound(PrintFiles)
Set PrintFiles(fCtr) = Workbooks.Open _
(FileName:=PrintFileNames(fCtr))
Range("A1").Select
'If it's the first workbook in the loop, and if the user wants to
'hide the same Column(s):
If fCtr = 1 Then
If Global_HideSameCols = True Then
'On Error Resume Next
* Set Global_ExclColRng = Application.InputBox("Use the left mouse " &

_
"button with the Control key," & vbNewLine & "to select at

least"
_
& " one cell in each column " & vbNewLine & "(or the entire" _
& ".column), to indicate those" & vbNewLine & "Columns to be" _
& " hidden. Click OK. when done", Type:=8)
'On Error GoTo 0
End If
End If
'But user might still want to hide a Column(s) in individual workbooks,
so:
If HideCols = True Then
If Global_HideSameCols = False Then
'On Error Resume Next
* Set Wkbk_ExclColRng = Application.InputBox("This is a test",
Type:=8)

If I direct the code through the first Set statement and select a range
to hide, then the code executes ok. If I direct it through the second Set
statement, I get an 'Object required' message.

Why is the code not working, and why is it inconsistent, please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Inconsistent code

I understand. Many thanks.

Regards.

"Tom Ogilvy" wrote in message
...
You get an error if the user hits cancel since the inputbox returns false
instead of a range you can't

set Global_ExclColRng = False

that is why the error handlers are there (you commented them out). They
catch the error and ignore it.

You then have to test the object to see if it was set

if Global_ExclColRng is nothing then
msgbox "You clicked cancel"
End if

--
Regards,
Tom Ogilvy

"Stuart" wrote in message
...
For fCtr = LBound(PrintFiles) To UBound(PrintFiles)
Set PrintFiles(fCtr) = Workbooks.Open _
(FileName:=PrintFileNames(fCtr))
Range("A1").Select
'If it's the first workbook in the loop, and if the user wants to
'hide the same Column(s):
If fCtr = 1 Then
If Global_HideSameCols = True Then
'On Error Resume Next
* Set Global_ExclColRng = Application.InputBox("Use the left mouse "

&
_
"button with the Control key," & vbNewLine & "to select at

least"
_
& " one cell in each column " & vbNewLine & "(or the entire"

_
& ".column), to indicate those" & vbNewLine & "Columns to be"

_
& " hidden. Click OK. when done", Type:=8)
'On Error GoTo 0
End If
End If
'But user might still want to hide a Column(s) in individual

workbooks,
so:
If HideCols = True Then
If Global_HideSameCols = False Then
'On Error Resume Next
* Set Wkbk_ExclColRng = Application.InputBox("This is a test",
Type:=8)

If I direct the code through the first Set statement and select a range
to hide, then the code executes ok. If I direct it through the second

Set
statement, I get an 'Object required' message.

Why is the code not working, and why is it inconsistent, please?

Regards.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.512 / Virus Database: 309 - Release Date: 19/08/2003


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
VLOOKUP inconsistent ... help. Wayne Excel Discussion (Misc queries) 2 February 22nd 10 09:07 AM
Inconsistent Formula? andrew Excel Discussion (Misc queries) 6 February 12th 09 05:04 AM
Calculation inconsistent PMBO Excel Discussion (Misc queries) 4 December 2nd 08 04:12 PM
Inconsistent Sorting Saxman Excel Discussion (Misc queries) 17 October 23rd 06 11:17 AM
3-d referencing inconsistent duncan79 Excel Discussion (Misc queries) 5 January 25th 06 05:39 PM


All times are GMT +1. The time now is 06:38 AM.

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"