Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default How to sort buttons

I have a VBA loop that reads file names from a directory. In the end I have a
worksheet with a bunch of filename listed (plus other file info). I also add
a button on each line that allows me to open the file. It all works
fine...until the user plays around with the sorting...When columns are
sorted, everything gets sorted except the buttons. In other words, after the
user sorts, the buttons on each line open the wrong files.

Here's the code that adds the button on each line:

sht.Range("AA" & intCurrentLine).Select
With mySheet.Buttons.Add(ActiveCell.Left, ActiveCell.Top, ActiveCell.Width,
ActiveCell.Height)
.Name = ...
.OnAction = ...
.Characters.Text = ...
End With

This code is inside another bigger loop that reads each file.

Thanks in advance
Ray

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default How to sort buttons

Just a thought ... If you create hyperlinks instead of buttons on each row,
you will still get one-click functionality to open the files, and the cells
with the hyperlinks will sort normally.

Hope this helps,

Hutch

"Ray C" wrote:

I have a VBA loop that reads file names from a directory. In the end I have a
worksheet with a bunch of filename listed (plus other file info). I also add
a button on each line that allows me to open the file. It all works
fine...until the user plays around with the sorting...When columns are
sorted, everything gets sorted except the buttons. In other words, after the
user sorts, the buttons on each line open the wrong files.

Here's the code that adds the button on each line:

sht.Range("AA" & intCurrentLine).Select
With mySheet.Buttons.Add(ActiveCell.Left, ActiveCell.Top, ActiveCell.Width,
ActiveCell.Height)
.Name = ...
.OnAction = ...
.Characters.Text = ...
End With

This code is inside another bigger loop that reads each file.

Thanks in advance
Ray

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default How to sort buttons

Hi Ray,

I use another scirpt that list all file in the search directory and adds a
hyperlink to open.
If interested, please post back.

Regards
JY

"Ray C" wrote in message
...
I have a VBA loop that reads file names from a directory. In the end I have
a
worksheet with a bunch of filename listed (plus other file info). I also
add
a button on each line that allows me to open the file. It all works
fine...until the user plays around with the sorting...When columns are
sorted, everything gets sorted except the buttons. In other words, after
the
user sorts, the buttons on each line open the wrong files.

Here's the code that adds the button on each line:

sht.Range("AA" & intCurrentLine).Select
With mySheet.Buttons.Add(ActiveCell.Left, ActiveCell.Top,
ActiveCell.Width,
ActiveCell.Height)
.Name = ...
.OnAction = ...
.Characters.Text = ...
End With

This code is inside another bigger loop that reads each file.

Thanks in advance
Ray




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default How to sort buttons

Hi Tom,

I solved my problem with the buttons, but I like your idea better. Oh well.

Thanks anyways
Ray


"Tom Hutchins" wrote:

Just a thought ... If you create hyperlinks instead of buttons on each row,
you will still get one-click functionality to open the files, and the cells
with the hyperlinks will sort normally.

Hope this helps,

Hutch

"Ray C" wrote:

I have a VBA loop that reads file names from a directory. In the end I have a
worksheet with a bunch of filename listed (plus other file info). I also add
a button on each line that allows me to open the file. It all works
fine...until the user plays around with the sorting...When columns are
sorted, everything gets sorted except the buttons. In other words, after the
user sorts, the buttons on each line open the wrong files.

Here's the code that adds the button on each line:

sht.Range("AA" & intCurrentLine).Select
With mySheet.Buttons.Add(ActiveCell.Left, ActiveCell.Top, ActiveCell.Width,
ActiveCell.Height)
.Name = ...
.OnAction = ...
.Characters.Text = ...
End With

This code is inside another bigger loop that reads each file.

Thanks in advance
Ray

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
Macro to create Sort buttons Mr X Z Excel Discussion (Misc queries) 9 July 3rd 11 09:16 AM
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
Sort without moving buttons David P. Excel Discussion (Misc queries) 1 July 3rd 05 12:36 AM
Adding buttons in a sheet to sort data Jimbob Excel Discussion (Misc queries) 1 July 1st 05 06:27 PM
Sort buttons by caption? David Excel Programming 3 December 26th 03 07:54 PM


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