LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
ade ade is offline
external usenet poster
 
Posts: 16
Default Can't change NumberFormat via Command button

I have a piece of code as follows :

Dim myCell as Range
For Each myCell in Selection
MyCell.NumberFormat = "@"
Next myCell

When I select a range of cells manually and run the macro from the <Tools
menu in Excel '97, it works fine but the problem is that if I put this code
in a button_click Sub, I get the error message 'Unable to change the
NumberFormat property of the Range Object' for the code 'myCell.NumberFormat
= "@".

Could someone suggest a reason(s) as to why this happens, I am completely
dumbfounded.
 
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
Change color of command button dhstein Excel Discussion (Misc queries) 1 May 21st 09 01:08 AM
How to change the default Command Button [email protected] Excel Programming 3 October 13th 06 03:02 AM
using vba to change command button caption PaulaO Excel Programming 2 April 5th 06 07:35 PM
CHANGE DATA SERIES WITH A COMMAND BUTTON Raymond Willis Charts and Charting in Excel 5 December 5th 05 05:49 PM
Change Name of Command Button comotoman Excel Discussion (Misc queries) 2 October 26th 05 05:23 PM


All times are GMT +1. The time now is 08:52 PM.

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"