Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default International Range style settings

Hi there,

I am using Excel 2007, the Ducth version.
I have created a workbook with macros, partly recorded.
In one of the I am using some code like

With ActiveCell
If .Value < gdblNormValue Then
.Style = "Ongeldig"
End If
End With

In the English version it shoul be

With ActiveCell
If .Value < gdblNormValue Then
.Style = "Bad"
End If
End With

Is there a constant I can ue instead of the text "Bad"?

Thanks

Wouter
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default International Range style settings

Styles have both Name and Local name properties, so I *think* the English
name should work in all language versions. I can't be sure as I only have
English, but try this -

Dim sty As Style
For Each sty In ActiveWorkbook.Styles
Debug.Print sty.Name, sty.NameLocal
Next

Regards,
Peter T


"Wouter HM" wrote in message
...
Hi there,

I am using Excel 2007, the Ducth version.
I have created a workbook with macros, partly recorded.
In one of the I am using some code like

With ActiveCell
If .Value < gdblNormValue Then
.Style = "Ongeldig"
End If
End With

In the English version it shoul be

With ActiveCell
If .Value < gdblNormValue Then
.Style = "Bad"
End If
End With

Is there a constant I can ue instead of the text "Bad"?

Thanks

Wouter



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default International Range style settings

Hi Peter,

It looks like you code only shows differences beteen .Name
and .NameLocal for the numeric styles
Comma
Comma [0]
Currency
Currency [0]

never the less thank for your effort so far.

Wouter
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default International Range style settings

Are you saying in your Dutch system you cannot do this

Set sty = Activeworkbook.Styles("Bad")

Regards,
Peter T


"Wouter HM" wrote in message
...
Hi Peter,

It looks like you code only shows differences beteen .Name
and .NameLocal for the numeric styles
Comma
Comma [0]
Currency
Currency [0]

never the less thank for your effort so far.

Wouter



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default International Range style settings

Hi Peter,

I am using something like

For Each rngLoop in Range("MyRange").Cells
If rngLoop.Value < 0.7 Then
rngLoop.Style = "Bad"
End If
Next

In My Dutch version I get an error on "Bad" while compiling.


Wouter


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default International Range style settings

Can you do this -

dim sName as string

sName = ""
on error resume next
sName = activeworkbook.styles("Bad").NameLocal
on error goto 0

if len(sName) then
'code
rngLoop.Style = sName


Also, what do you get with this

with activeworkbook.styles("Ongeldig")
debug.? .Name, .NameLocal
end with

and can you do this
Set sty = activeworkbook.styles("Bad")

Regards,
Peter T


"Wouter HM" wrote in message
...
Hi Peter,

I am using something like

For Each rngLoop in Range("MyRange").Cells
If rngLoop.Value < 0.7 Then
rngLoop.Style = "Bad"
End If
Next

In My Dutch version I get an error on "Bad" while compiling.


Wouter



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default International Range style settings

Hi Peter,

Using your code:

sName is an empty string ("")

In the direct pane I get twice Ongeldig

On the Set sty = .... I get Error (Subscrip Out of Range)

Regards,
Wouter
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default International Range style settings

That's a shame, OK I will enquire further.

Regards,
Peter T

"Wouter HM" wrote in message
...
Hi Peter,

Using your code:

sName is an empty string ("")

In the direct pane I get twice Ongeldig

On the Set sty = .... I get Error (Subscrip Out of Range)

Regards,
Wouter



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default International Range style settings

Finally this workaround suggested by Ron de Bruin should work

Built-in style names update to the current local names in cells containing
the styles. Apply your style to some cell, it could be on a hidden sheet or
even on a sheet in an addin.

StyleName = ThisWorkbook.Worksheets(1).Range("A1").Style
myRange.Style = StyleName

Ron said he will probably update his International page to include a note
about this

http://www.rondebruin.nl/international.htm

Regards,
Peter T



"Peter T" <peter_t@discussions wrote in message
...
That's a shame, OK I will enquire further.

Regards,
Peter T

"Wouter HM" wrote in message
...
Hi Peter,

Using your code:

sName is an empty string ("")

In the direct pane I get twice Ongeldig

On the Set sty = .... I get Error (Subscrip Out of Range)

Regards,
Wouter





  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default International Range style settings

Ron said he will probably update his International page to include a note
about this


Done, see
http://www.rondebruin.nl/international.htm#Style

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



"Peter T" <peter_t@discussions wrote in message ...
Finally this workaround suggested by Ron de Bruin should work

Built-in style names update to the current local names in cells containing
the styles. Apply your style to some cell, it could be on a hidden sheet or
even on a sheet in an addin.

StyleName = ThisWorkbook.Worksheets(1).Range("A1").Style
myRange.Style = StyleName

Ron said he will probably update his International page to include a note
about this

http://www.rondebruin.nl/international.htm

Regards,
Peter T



"Peter T" <peter_t@discussions wrote in message
...
That's a shame, OK I will enquire further.

Regards,
Peter T

"Wouter HM" wrote in message
...
Hi Peter,

Using your code:

sName is an empty string ("")

In the direct pane I get twice Ongeldig

On the Set sty = .... I get Error (Subscrip Out of Range)

Regards,
Wouter







  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 99
Default International Range style settings

Both Peter an Ron,

Many thanks for your help.

I will use Peters idea.

Regards,

Wouter
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
How to set style in Range object? SmartGuy Excel Programming 4 August 28th 08 02:43 AM
How do I change sheet notation from R1C1 style to A1 style in XL 2 Sherlock1506 Setting up and Configuration of Excel 1 December 5th 06 03:22 PM
Excel2000: Opening *.csv through VBA and International Settings Arvi Laanemets Excel Programming 11 October 31st 06 11:54 AM
Checking for the border style of a range Peter Rooney Excel Programming 4 January 9th 06 09:23 AM
A1 style Range in programming [email protected] Excel Programming 3 September 1st 04 02:43 PM


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