#1   Report Post  
John Davies
 
Posts: n/a
Default EXCEL

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

Just because you want upper case in that cell, you don't have to inflict it
on us.

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Address = "$H$1" Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

"John Davies" <John wrote in message
...
HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY



  #3   Report Post  
John Data
 
Posts: n/a
Default

Thanks Bob Phillips

This works fine on 1 cell, however there are another 3 individual cells
that should show only uppercase. I have tried pasting the code again with
different cell values but I get a compile error.
Is there a way to do this?

"John Davies" wrote:

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY

  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Change

If Target.Address = "$H$1" Then

to the cells you want, for example

If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then


--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob Phillips

This works fine on 1 cell, however there are another 3 individual cells
that should show only uppercase. I have tried pasting the code again with
different cell values but I get a compile error.
Is there a way to do this?

"John Davies" wrote:

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY



  #5   Report Post  
John Data
 
Posts: n/a
Default

Bob

I changed the line as you advised but nothing happens after I paste the code.
The pasted lines are as follows:-

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Is ther anything wrong with these?

Thanks


"Bob Phillips" wrote:

Change

If Target.Address = "$H$1" Then

to the cells you want, for example

If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then


--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob Phillips

This works fine on 1 cell, however there are another 3 individual cells
that should show only uppercase. I have tried pasting the code again with
different cell values but I get a compile error.
Is there a way to do this?

"John Davies" wrote:

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY






  #6   Report Post  
Bob Phillips
 
Posts: n/a
Default

John,

It works fine for me. Make sure you have events enabled, type this in the VB
IDE immediate window

Application.EnableEvents = True

and return.

--
HTH

Bob Phillips

"John Data" wrote in message
...
Bob

I changed the line as you advised but nothing happens after I paste the

code.
The pasted lines are as follows:-

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Is ther anything wrong with these?

Thanks


"Bob Phillips" wrote:

Change

If Target.Address = "$H$1" Then

to the cells you want, for example

If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then


--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob Phillips

This works fine on 1 cell, however there are another 3 individual

cells
that should show only uppercase. I have tried pasting the code again

with
different cell values but I get a compile error.
Is there a way to do this?

"John Davies" wrote:

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY






  #7   Report Post  
John Data
 
Posts: n/a
Default

Thanks Bob

I restarted Excel and the code now works fine but I did not understand what
you meant by "have events enabled, type this in the VB IDE immediate window".
Where is that?"


"Bob Phillips" wrote:

John,

It works fine for me. Make sure you have events enabled, type this in the VB
IDE immediate window

Application.EnableEvents = True

and return.

--
HTH

Bob Phillips

"John Data" wrote in message
...
Bob

I changed the line as you advised but nothing happens after I paste the

code.
The pasted lines are as follows:-

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Is ther anything wrong with these?

Thanks


"Bob Phillips" wrote:

Change

If Target.Address = "$H$1" Then

to the cells you want, for example

If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then


--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob Phillips

This works fine on 1 cell, however there are another 3 individual

cells
that should show only uppercase. I have tried pasting the code again

with
different cell values but I get a compile error.
Is there a way to do this?

"John Davies" wrote:

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY






  #8   Report Post  
Bob Phillips
 
Posts: n/a
Default

Hi John,

The code I gave you is worksheet event code. There is a property called
EnableEvents which can be turned on or off. If Off, the event will not fire,
so nothing happens. If you look at the code you will see

Application.EnableEvents = False

at the start, and

Application.EnableEvents = True

at the end. This is done to stop events cascading from our code.

The immediate window is a window in the VB IDE (Alt-F11). You open it from
the ViewImmediate Window (or Ctrl-G). This allows you test things out in
immediate mode, or look at variables when stepping through code.

--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob

I restarted Excel and the code now works fine but I did not understand

what
you meant by "have events enabled, type this in the VB IDE immediate

window".
Where is that?"


"Bob Phillips" wrote:

John,

It works fine for me. Make sure you have events enabled, type this in

the VB
IDE immediate window

Application.EnableEvents = True

and return.

--
HTH

Bob Phillips

"John Data" wrote in message
...
Bob

I changed the line as you advised but nothing happens after I paste

the
code.
The pasted lines are as follows:-

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Is ther anything wrong with these?

Thanks


"Bob Phillips" wrote:

Change

If Target.Address = "$H$1" Then

to the cells you want, for example

If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then


--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob Phillips

This works fine on 1 cell, however there are another 3 individual

cells
that should show only uppercase. I have tried pasting the code

again
with
different cell values but I get a compile error.
Is there a way to do this?

"John Davies" wrote:

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY








  #9   Report Post  
John Data
 
Posts: n/a
Default

Hi Bob
Thanks for all your help

"Bob Phillips" wrote:

Hi John,

The code I gave you is worksheet event code. There is a property called
EnableEvents which can be turned on or off. If Off, the event will not fire,
so nothing happens. If you look at the code you will see

Application.EnableEvents = False

at the start, and

Application.EnableEvents = True

at the end. This is done to stop events cascading from our code.

The immediate window is a window in the VB IDE (Alt-F11). You open it from
the ViewImmediate Window (or Ctrl-G). This allows you test things out in
immediate mode, or look at variables when stepping through code.

--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob

I restarted Excel and the code now works fine but I did not understand

what
you meant by "have events enabled, type this in the VB IDE immediate

window".
Where is that?"


"Bob Phillips" wrote:

John,

It works fine for me. Make sure you have events enabled, type this in

the VB
IDE immediate window

Application.EnableEvents = True

and return.

--
HTH

Bob Phillips

"John Data" wrote in message
...
Bob

I changed the line as you advised but nothing happens after I paste

the
code.
The pasted lines are as follows:-

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then
With Target
.Value = UCase(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Is ther anything wrong with these?

Thanks


"Bob Phillips" wrote:

Change

If Target.Address = "$H$1" Then

to the cells you want, for example

If Not Intersect(Target, Range("H1,M5,O11,F7")) Is Nothing Then


--
HTH

Bob Phillips

"John Data" wrote in message
...
Thanks Bob Phillips

This works fine on 1 cell, however there are another 3 individual
cells
that should show only uppercase. I have tried pasting the code

again
with
different cell values but I get a compile error.
Is there a way to do this?

"John Davies" wrote:

HOW CAN I MAKE A SINGLE CELL IN EXCEL DISPLAY UPPERCASE ONLY









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
"Group" function very slow with Excel 2003 :( ... While very quick with Excel2000 :O) Alain79 Excel Discussion (Misc queries) 4 June 14th 05 07:34 AM
Stop Excel Rounding Dates leinad512 Excel Discussion (Misc queries) 1 April 20th 05 04:19 PM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Excel error - Startup (and Acrobat PDFMaker) gxdata Setting up and Configuration of Excel 0 February 4th 05 03:44 AM
Excel 2002 and 2000 co-install. Control Which Starts ? cnuk Excel Discussion (Misc queries) 2 January 17th 05 08:07 PM


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