Excel with IE problem

A

ashish.kare

Hi,

We are having one Excel file which contain macros. The user has two
options to download this report output file, they can download and
save to harddisk OR open report into browser directly by using Open
command. On the sheet, we gave sort order functionality. The sort
order code work correct when user used Download and Save option.


However when user used open command to open report directly into
browser, report open correct but sort order code not work.


The line where i m getting error is given below


sSheetName = ActiveSheet.Name


Also i m attaching complete code below: Please provide me
solution....


Sheets(sSheetName).Select


' Find Number of Rows
Sheets(sSheetName).Cells(10, 1).Select
intKeyRow = Selection.End(xlDown).Row


Sheets(sSheetName).Range("A9:Q" & intKeyRow).Select
intKeyRow = 9


'Sort by IPTV Column
If FrmTopIssue.optIPTV.Value = True Then
Selection.Sort Key1:=Range("E" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If


'Sort By CPV Column
If FrmTopIssue.optCPV.Value = True Then
Selection.Sort Key1:=Range("F" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If
'Sort By Cost Column
If FrmTopIssue.optCost.Value = True Then
Selection.Sort Key1:=Range("H" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If
'Sort By Cases Column
If FrmTopIssue.optCases.Value = True Then
Selection.Sort Key1:=Range("I" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If
AddRankColumn (sSheetName)
Sheets(sSheetName).Cells(5, 1).Select


Thanks in advance
Ashish
 
J

Jean-Yves

Change your code to use vb object like Sheet1, Sheet2, etc
Sheets or worksheets collection do no seems to be supported.
regards
JY
 
D

Dave Peterson

Check your other post.

Hi,

We are having one Excel file which contain macros. The user has two
options to download this report output file, they can download and
save to harddisk OR open report into browser directly by using Open
command. On the sheet, we gave sort order functionality. The sort
order code work correct when user used Download and Save option.

However when user used open command to open report directly into
browser, report open correct but sort order code not work.

The line where i m getting error is given below

sSheetName = ActiveSheet.Name

Also i m attaching complete code below: Please provide me
solution....

Sheets(sSheetName).Select

' Find Number of Rows
Sheets(sSheetName).Cells(10, 1).Select
intKeyRow = Selection.End(xlDown).Row

Sheets(sSheetName).Range("A9:Q" & intKeyRow).Select
intKeyRow = 9

'Sort by IPTV Column
If FrmTopIssue.optIPTV.Value = True Then
Selection.Sort Key1:=Range("E" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If

'Sort By CPV Column
If FrmTopIssue.optCPV.Value = True Then
Selection.Sort Key1:=Range("F" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If
'Sort By Cost Column
If FrmTopIssue.optCost.Value = True Then
Selection.Sort Key1:=Range("H" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If
'Sort By Cases Column
If FrmTopIssue.optCases.Value = True Then
Selection.Sort Key1:=Range("I" & intKeyRow),
Order1:=xlDescending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom
End If
AddRankColumn (sSheetName)
Sheets(sSheetName).Cells(5, 1).Select

Thanks in advance
Ashish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top