Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Data with starting with - causes Type Mismatch | Excel Programming | |||
Help: Compile error: type mismatch: array or user defined type expected | Excel Programming | |||
Database Query -- Data Type Mismatch | Excel Discussion (Misc queries) | |||
Type Mismatch Error when getting data from another workbook | Excel Programming | |||
Varient Int data type mismatch | Excel Programming |