Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ucase 'data type mismatch'


I'm trying to make my selection uppercase by doing something like this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default ucase 'data type mismatch'

Gotta run. But existing code only works on a single-cell narrow your
highlighted-area and retry.
HTH

"DKY" wrote in
message :

I'm trying to make my selection uppercase by doing something like this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default ucase 'data type mismatch'

try this

Option Explicit
Dim cell As Range
Sub test()
For Each cell In Selection
cell.Value = UCase(cell.Value)
Next
End Sub

--


Gary


"DKY" wrote in message
...

I'm trying to make my selection uppercase by doing something like this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY
------------------------------------------------------------------------
DKY's Profile:
http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ucase 'data type mismatch'

For Each cell In Selection
cell.Value = UCase(cell.Value)
Next cell



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DKY" wrote in message
...

I'm trying to make my selection uppercase by doing something like this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ucase 'data type mismatch'


I think that the code only goes through one cell at a time, I'll pos
the code below

Code
-------------------
Option Explicit

Sub HEADER_MAKER()
Dim CELL
Application.ScreenUpdating = False
For Each CELL In Selection
With Selection.Interior
.ColorIndex = 40
.Pattern = xlSolid
End With
CELL.Borders(xlDiagonalDown).LineStyle = xlNone
CELL.Borders(xlDiagonalUp).LineStyle = xlNone
With CELL.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With CELL.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With CELL.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
With CELL.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Selection.Font.Bold = True
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection.Font
.Name = "Times New Roman"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With

' START REPLACE
Selection.Replace What:=" ", Replacement:="_", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
' END REPLACE
' START REPLACE
Selection.Replace What:=".", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
' END REPLACE

'Selection.Value = upper(Selection.Value)

Selection.EntireColumn.AutoFit

Next CELL
End Sub

-------------------

--
DK
-----------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...fo&userid=1451
View this thread: http://www.excelforum.com/showthread.php?threadid=56553



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default ucase 'data type mismatch'

If selection.TypeName = "Range" then
if selection.Count = 1 then
if not iserror(selection) then
selection.Value = ucase(selection.Value)
end if
end if
end if

--
Regards,
Tom Ogilvy


"DKY" wrote:


I'm trying to make my selection uppercase by doing something like this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ucase 'data type mismatch'


That's perfect!!

Not Selection.value but CELL.value, that makes sense.

Bob Phillips Wrote:
For Each cell In Selection
cell.Value = UCase(cell.Value)
Next cell



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DKY" wrote in
message
...

I'm trying to make my selection uppercase by doing something like

this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY

------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread:

http://www.excelforum.com/showthread...hreadid=565539



--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default ucase 'data type mismatch'


That's perfect!!

Not Selection.value but CELL.value, that makes sense.

Bob Phillips Wrote:
For Each cell In Selection
cell.Value = UCase(cell.Value)
Next cell



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DKY" wrote in
message
...

I'm trying to make my selection uppercase by doing something like

this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY

------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread:

http://www.excelforum.com/showthread...hreadid=565539



--
DKY
------------------------------------------------------------------------
DKY's Profile: http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default ucase 'data type mismatch'

Yes, but cell is just an object name that I chose (it kinda makes sense). It
could as easily be

For Each sausage In Selection
sausage.Value = UCase(sausage.Value)
Next sausage

that variable is just used to refer to each item in the collection (of
selected cells here)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DKY" wrote in message
...

That's perfect!!

Not Selection.value but CELL.value, that makes sense.

Bob Phillips Wrote:
For Each cell In Selection
cell.Value = UCase(cell.Value)
Next cell



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DKY" wrote in
message
...

I'm trying to make my selection uppercase by doing something like

this.

Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY

------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread:

http://www.excelforum.com/showthread...hreadid=565539



--
DKY
------------------------------------------------------------------------
DKY's Profile:

http://www.excelforum.com/member.php...o&userid=14515
View this thread: http://www.excelforum.com/showthread...hreadid=565539



  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default ucase 'data type mismatch'

Bob:
Great !! -- I now grasp the full concept of "For Each ..." through
this illustration -- keep such 'em coming.
Jim May


"Bob Phillips" wrote in message
:

Yes, but cell is just an object name that I chose (it kinda makes sense). It
could as easily be

For Each sausage In Selection
sausage.Value = UCase(sausage.Value)
Next sausage

that variable is just used to refer to each item in the collection (of
selected cells here)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DKY" wrote in message
...


That's perfect!!

Not Selection.value but CELL.value, that makes sense.

Bob Phillips Wrote:


For Each cell In Selection
cell.Value = UCase(cell.Value)
Next cell



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"DKY" wrote in
message
...



I'm trying to make my selection uppercase by doing something like


this.



Selection.Value = ucase(Selection.Value)

and it keeps giving me a data type mismatch error. What am I doing
wrong here?


--
DKY


------------------------------------------------------------------------


DKY's Profile:


http://www.excelforum.com/member.php...o&userid=14515


View this thread:


http://www.excelforum.com/showthread...hreadid=565539






--
DKY
------------------------------------------------------------------------
DKY's Profile:


http://www.excelforum.com/member.php...o&userid=14515

View this thread: http://www.excelforum.com/showthread...hreadid=565539


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
Data with starting with - causes Type Mismatch icdoo[_4_] Excel Programming 3 December 31st 05 03:40 PM
Help: Compile error: type mismatch: array or user defined type expected lvcha.gouqizi Excel Programming 1 October 31st 05 08:20 PM
Database Query -- Data Type Mismatch StephenP Excel Discussion (Misc queries) 0 April 14th 05 07:05 PM
Type Mismatch Error when getting data from another workbook Tony Zappal Excel Programming 2 January 12th 05 10:29 PM
Varient Int data type mismatch Kevin Excel Programming 0 August 12th 03 03:51 AM


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