Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Cells.Select won't work!!!

Hei Neil

You don't have to activate or select anything to sort a table. If you
explain what this
CSV = ActiveCell.Value
Windows(CSV).Activate
does, I could perhaps write you a working demo.

HTH. best wishes Harald


"Neil Cash" skrev i melding
...
I have a workbook that contains a macro that opens a file. Then the file

is
sorted the way it should. But I get an error on the Cells.Select command:
Run-time error '1004': Select method of Range class failed
Here's what my code looks like:

ActiveWorkbook.Save
Range("D4").Select
CSV = ActiveCell.Value
Windows(CSV).Activate
Cells.Select
Selection.Sort Key1:=Range("C2"), Order1:=xlAscending, Key2:=Range("A2") _
, Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal,
DataOption2 _
:=xlSortNormal

Is there a different way to select all the cells in the workbook? Does
anyone have any ideas about what I'm missing? Thanks in advance. I don't
know if it matters, but the file that is being sorted is a csv file.



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
Up down arrow keys do not select cells if select locked cells unch roandrob Excel Discussion (Misc queries) 3 May 18th 09 12:48 AM
Macro to select cells without a certain value and select a menu it Guy[_2_] Excel Worksheet Functions 9 January 2nd 09 05:21 PM
Can't get VBA to work without select D. Excel Discussion (Misc queries) 6 February 5th 08 12:30 PM
how do you "select locked cells" w/o "select unlocked cells"? princejohnpaulfin Excel Discussion (Misc queries) 3 July 16th 05 03:53 AM
Select an array of cells and paste to separate worksheet - 2nd post - 1st didn't work!! Lee Wold[_2_] Excel Programming 1 February 10th 04 03:22 PM


All times are GMT +1. The time now is 07:35 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"