Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello-
I have the code below which is evaluating cell (E6) and entering a text string in (D15) based on the value. I want to replace the XXX part of the string with the value of (A6) if each scenario. Any ideas? Thanks in advance. Scott Sub Com1() Dim myCell As Range Set myCell = Selection On Error Resume Next If Range("E6").Value <= 8 Then Range("d16").Select ActiveCell.FormulaR1C1 = "Great job, you handled XXX calls yesterday!" ElseIf Range("E6").Value <= 8.25 Then Range("d16").Select ActiveCell.FormulaR1C1 = "Way to go, your XXX calls really made a difference!" ElseIf Range("E6").Value <= 8.5 Then Range("d16").Select ActiveCell.FormulaR1C1 = "Wow, XXX calls in one day is fantastic!" End If myCell.Select End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i would add these 2 lines:
dim ws as worksheet set ws = worksheets("Sheet1") then ActiveCell.Value = "Wow, " & ws.Range("A1").Value & "calls in one day is fantastic!" -- Gary "Scott" wrote in message ... Hello- I have the code below which is evaluating cell (E6) and entering a text string in (D15) based on the value. I want to replace the XXX part of the string with the value of (A6) if each scenario. Any ideas? Thanks in advance. Scott Sub Com1() Dim myCell As Range Set myCell = Selection On Error Resume Next If Range("E6").Value <= 8 Then Range("d16").Select ActiveCell.FormulaR1C1 = "Great job, you handled XXX calls yesterday!" ElseIf Range("E6").Value <= 8.25 Then Range("d16").Select ActiveCell.FormulaR1C1 = "Way to go, your XXX calls really made a difference!" ElseIf Range("E6").Value <= 8.5 Then Range("d16").Select ActiveCell.FormulaR1C1 = "Wow, XXX calls in one day is fantastic!" End If myCell.Select End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gary Keramidas schrieb:
ActiveCell.Value = "Wow, " & ws.Range("A1").Value & "calls in one day is fantastic!" I think it's better to use this code: ActiveCell.Value = "Wow, " + ws.Range("A1").Text + "calls in one day _ is fantastic!" AFAIR is '&' the operator for 'Binary AND'. To concat strings in VBA, you need the '+' operator. And I found that using the .text property of a range saves you some hassle, if the content of the cell can be interpreted as something other than a string. CU, Christian |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Insert Cell Data Into String | Excel Worksheet Functions | |||
Insert characters into String | Excel Programming | |||
Need macro to insert text string while inside cell (formula) | Excel Discussion (Misc queries) | |||
Does Alt-Enter insert a non-printing character in a cell string? | Excel Programming | |||
How to insert: " into a string | Excel Programming |