Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Updating cell value by case

I want the value in cell H18 to appear or not appear based on the
value selected and displayed in cell N14. For example, when cell N14
= "Diamond" I want the value in cell H18 to be hidden. Here's my code
but the statement for case "Diamond" won't execute:

Private Sub Worksheet()

Dim Pattern As String

Pattern = Range("N14")

Application.ScreenUpdating = False
Application.ActiveSheet.Range("H18").Select
Application.ScreenUpdating = True

Select Case (Pattern)

'Application.ActiveSheet.Range("H18").Select

Case "Diamond"

Cell.Value = ""

End Select


End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Updating cell value by case

First, I wouldn't name a macro Worksheet or use a variable named Pattern. Both
of these are used by excel's VBA.

Second, maybe something like:

Option Explicit
Private Sub myMacro()

Dim myPattern As String
Dim myCell As Range

myPattern = Range("N14").Value

Set myCell = Range("h18")

Select Case LCase(myPattern)
Case LCase("Diamond")
myCell.Value = ""
End Select

End Sub

wrote:

I want the value in cell H18 to appear or not appear based on the
value selected and displayed in cell N14. For example, when cell N14
= "Diamond" I want the value in cell H18 to be hidden. Here's my code
but the statement for case "Diamond" won't execute:

Private Sub Worksheet()

Dim Pattern As String

Pattern = Range("N14")

Application.ScreenUpdating = False
Application.ActiveSheet.Range("H18").Select
Application.ScreenUpdating = True

Select Case (Pattern)

'Application.ActiveSheet.Range("H18").Select

Case "Diamond"

Cell.Value = ""

End Select

End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Updating cell value by case

twlove,

If you have a real need to select H18, then, change

Cell.Value = ""

with this

ActiveCell.Value = ""


However, note that you don't need to select a cell to work with it so you
can also code it this way:

Private Sub Worksheet()

Dim Pattern As String

Pattern = Range("N14")

Select Case (Pattern)
Case "Diamond"
Range("H18").Value = ""
End Select

End Sub




--
Hope that helps.

Vergel Adriano


" wrote:

I want the value in cell H18 to appear or not appear based on the
value selected and displayed in cell N14. For example, when cell N14
= "Diamond" I want the value in cell H18 to be hidden. Here's my code
but the statement for case "Diamond" won't execute:

Private Sub Worksheet()

Dim Pattern As String

Pattern = Range("N14")

Application.ScreenUpdating = False
Application.ActiveSheet.Range("H18").Select
Application.ScreenUpdating = True

Select Case (Pattern)

'Application.ActiveSheet.Range("H18").Select

Case "Diamond"

Cell.Value = ""

End Select


End Sub


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
change data of entire column from small case to upper case Ann Excel Worksheet Functions 1 August 16th 08 01:06 PM
Changing multiple cell text from lower case to upper case Patti Excel Discussion (Misc queries) 2 January 4th 08 08:35 PM
excel'03 how to convert a column from upper case to proper case sharie palmer Excel Discussion (Misc queries) 1 January 30th 06 11:50 PM
Change the text from lower case to upper case in an Excel work boo dave01968 Excel Discussion (Misc queries) 2 December 9th 05 09:09 AM
How do I change existing text from lower case to upper case CT Cameron Excel Discussion (Misc queries) 2 November 30th 04 01:07 AM


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