#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default buttons

This is the code I currently have:

Sub resetbutton()
Dim ActSheet As Worksheet

sh = 3
Do
sh = sh + 1
Set ActSheet = Sheets(sh)

actsheet.Buttons.Add(298.5, 0.75, 51, 19.5).Select

With Selection
.OnAction = "ResetExpButton"
.Characters.Text = "Reset "
End With

Loop Until sh = Sheets.Count

End Sub

Problem. because I'm using "with selection" the "name of the button on
every page but the first(or active page) is not getting names "Reset ".

Solution. Is there anyway I can use : actsheet.Buttons.Add(298.5, 0.75, 51,
19.5).Select without using the "select" statement. In other words create on
object for the button.

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default buttons

Hi Dstiefe,

Try:

'=================
Sub ResetButton()
Dim i As Long
Dim BTN As Button
For i = 4 To ActiveWorkbook.Worksheets.Count

Set BTN = Sheets(i).Buttons.Add(298.5, 0.75, 51, 19.5)

With BTN
.OnAction = "ResetExpButton"
.Characters.Text = "Reset "
End With
Next i

End Sub
'<<=================

---
Regards,
Norman



"dstiefe" wrote in message
...
This is the code I currently have:

Sub resetbutton()
Dim ActSheet As Worksheet

sh = 3
Do
sh = sh + 1
Set ActSheet = Sheets(sh)

actsheet.Buttons.Add(298.5, 0.75, 51, 19.5).Select

With Selection
.OnAction = "ResetExpButton"
.Characters.Text = "Reset "
End With

Loop Until sh = Sheets.Count

End Sub

Problem. because I'm using "with selection" the "name of the button on
every page but the first(or active page) is not getting names "Reset ".

Solution. Is there anyway I can use : actsheet.Buttons.Add(298.5, 0.75,
51,
19.5).Select without using the "select" statement. In other words create
on
object for the button.

Thank you



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
Option Buttons/Radio Buttons John Calder New Users to Excel 7 May 16th 08 03:51 AM
Form buttons vs. ActiveX Buttons GeorgeJ Excel Discussion (Misc queries) 3 August 11th 07 09:02 PM
have toggle buttons but everytime print preview buttons move TinSandhu Excel Discussion (Misc queries) 1 October 11th 06 02:57 PM
pivot chart is it possible to hide individual field buttons? Layout Field buttons Matt Charts and Charting in Excel 0 August 27th 06 02:57 PM
Control Buttons vs. Command Buttons Robert Gibson Excel Programming 1 October 13th 03 04:33 PM


All times are GMT +1. The time now is 02:27 PM.

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"