Re: Help me Changing the value to string using quote!!

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bernie Deitrick (_at_)
Date: 03/18/04


Date: Thu, 18 Mar 2004 09:29:46 -0500

Stathis,

Change

   rng.Copy
   rng.PasteSpecial Paste:=xlPasteValues
   Application.CutCopyMode = False

to
  Dim myCell As Range
  For Each myCell In rng
  myCell.Value = "'" & myCell.Value
  Next myCell

HTH,
Bernie
MS Excel MVP

"stakar >" <<stakar.13beyo@excelforum-nospam.com> wrote in message
news:stakar.13beyo@excelforum-nospam.com...
> I have the following code
>
> Code:
> --------------------
>
> Set rng = Range([BH4], [A65536].End(xlUp)(1, 60))
> Set checkboxrange = [A1:BG1].SpecialCells(xlCellTypeConstants, 2)
>
> For Each ThisCell In checkboxrange
> s = s & "&" & ThisCell(4).Address(False, False)
> Next ThisCell
>
> 'Turn off screen
> Application.ScreenUpdating = False
>
> rng.ClearContents
> [BH4] = "=" & Mid(s, 2, Len(s) - 1)
> [BH4].Copy rng
> rng.Copy
> rng.PasteSpecial Paste:=xlPasteValues
> Application.CutCopyMode = False
>
> --------------------
>
>
> The above code concatenate checked cells and copy them till the end of
> the range "BH" and then using the copy paste special, copies only the
> values.
> What I want is , for each value to add the quote (eg '01 or '0 or
> '00010 etc) because i want to change them to strings
>
> I found this:
> Range("BH4").Value = "'" & CStr([BH4])
> -----------------------------------------------
> But i cant do anything more!
> If its possible the code not to work cell by cell because the range of
> rows is huge and it will become very slow
>
> Thanks in advance!!
> *********************************
> Stathis
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>



Relevant Pages

  • Re: How to show a date and time with a in it???
    ... I did a bad job of trimming J.E. McGimpsey's code to handle only one cell ... > MS Excel MVP ... > Dim myCell As Range ... > Public Function IsTimeAs Boolean ...
    (microsoft.public.excel.programming)
  • Re: moving columns
    ... Sub matchCopy() ... Dim myRng As Range ... Dim myCell As Range ... the found item cell can be cut, ...
    (microsoft.public.excel.programming)
  • Re: moving columns
    ... Sub matchCopy() ... Dim myRng As Range ... Dim myCell As Range ... the found item cell can be cut, ...
    (microsoft.public.excel.programming)
  • Re: moving columns
    ... Sub matchCopy() ... Dim myRng As Range ... Dim myCell As Range ... the found item cell can be cut, ...
    (microsoft.public.excel.programming)
  • Re: moving columns
    ... Sub matchCopy() ... Dim myRng As Range ... Dim myCell As Range ... the found item cell can be cut, ...
    (microsoft.public.excel.programming)