Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Getting " into a String

I have been trying to write a small help to get an indirect formula
into Sheet2. Problem is that the indirect formula needs to have the "
in it: =indirect(Sheet1!"A1"). what I tried to do is this

Dim Cell As String
Dim Cell2 As String
Dim Teller As Integer
Dim Letterteller As Integer

For Letterteller = 1 To 5
If Letterteller = 1 Then Letter = "A"
If Letterteller = 2 Then Letter = "B"
If Letterteller = 3 Then Letter = "C"
If Letterteller = 4 Then Letter = "D"
If Letterteller = 5 Then Letter = "E"

For Teller = 1 To 100
Cell = Letter & Teller
Cell2 = """ & Cell & """
ActiveCell.Formula = "=indirect(Sheet1!" & Cell2 & ")"
Next
Next

Something has to be wrong with the Definition of Cell2 ( Cell2 = """ &
Cell & """), but I can't figure out how to get around it. And I
definitly don't want to manually change 500 cells myself. :-(

Anyone?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Getting " into a String

On 27 mrt, 15:43, "Dan Jansen" wrote:
I have been trying to write a small help to get an indirect formula
into Sheet2. Problem is that the indirect formula needs to have the "
in it: =indirect(Sheet1!"A1"). what I tried to do is this

Dim Cell As String
Dim Cell2 As String
Dim Teller As Integer
Dim Letterteller As Integer

For Letterteller = 1 To 5
If Letterteller = 1 Then Letter = "A"
If Letterteller = 2 Then Letter = "B"
If Letterteller = 3 Then Letter = "C"
If Letterteller = 4 Then Letter = "D"
If Letterteller = 5 Then Letter = "E"

For Teller = 1 To 100
Cell = Letter & Teller
Cell2 = """ & Cell & """
ActiveCell.Formula = "=indirect(Sheet1!" & Cell2 & ")"
Next
Next

Something has to be wrong with the Definition of Cell2 ( Cell2 = """ &
Cell & """), but I can't figure out how to get around it. And I
definitly don't want to manually change 500 cells myself. :-(

Anyone?


Sorry, found it already: use Chr(34) instead of """

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Getting " into a String

Or use """"
In article . com,
"Dan Jansen" wrote:

Sorry, found it already: use Chr(34) instead of """

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Getting " into a String

For Letterteller = 1 To 5
If Letterteller = 1 Then Letter = "A"
If Letterteller = 2 Then Letter = "B"


I see you have an answer.
Just throwing out an idea for a part of your code...

For LetterTeller = 1 To 5
Letter = Chr(LetterTeller + 64)
'etc
Next

--
HTH :)
Dana DeLouis
Windows XP & Office 2007


"Dan Jansen" wrote in message
oups.com...
I have been trying to write a small help to get an indirect formula
into Sheet2. Problem is that the indirect formula needs to have the "
in it: =indirect(Sheet1!"A1"). what I tried to do is this

Dim Cell As String
Dim Cell2 As String
Dim Teller As Integer
Dim Letterteller As Integer

For Letterteller = 1 To 5
If Letterteller = 1 Then Letter = "A"
If Letterteller = 2 Then Letter = "B"
If Letterteller = 3 Then Letter = "C"
If Letterteller = 4 Then Letter = "D"
If Letterteller = 5 Then Letter = "E"

For Teller = 1 To 100
Cell = Letter & Teller
Cell2 = """ & Cell & """
ActiveCell.Formula = "=indirect(Sheet1!" & Cell2 & ")"
Next
Next

Something has to be wrong with the Definition of Cell2 ( Cell2 = """ &
Cell & """), but I can't figure out how to get around it. And I
definitly don't want to manually change 500 cells myself. :-(

Anyone?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Getting " into a String

try this

Sub asd()

Dim Cell As String
Dim Cell2 As String
Dim Teller As Integer
Dim Letterteller As Integer

For Letterteller = 1 To 5
If Letterteller = 1 Then Letter = "A"
If Letterteller = 2 Then Letter = "B"
If Letterteller = 3 Then Letter = "C"
If Letterteller = 4 Then Letter = "D"
If Letterteller = 5 Then Letter = "E"

For Teller = 1 To 100
Cell = Letter & Teller
Cell2 = "" & Cell & ""
Cell2 = "=indirect(Sheet1!" & Cell2 & ")"
ActiveCell.Formula = Cell2
Next
Next

"Dan Jansen" wrote:

I have been trying to write a small help to get an indirect formula
into Sheet2. Problem is that the indirect formula needs to have the "
in it: =indirect(Sheet1!"A1"). what I tried to do is this

Dim Cell As String
Dim Cell2 As String
Dim Teller As Integer
Dim Letterteller As Integer

For Letterteller = 1 To 5
If Letterteller = 1 Then Letter = "A"
If Letterteller = 2 Then Letter = "B"
If Letterteller = 3 Then Letter = "C"
If Letterteller = 4 Then Letter = "D"
If Letterteller = 5 Then Letter = "E"

For Teller = 1 To 100
Cell = Letter & Teller
Cell2 = """ & Cell & """
ActiveCell.Formula = "=indirect(Sheet1!" & Cell2 & ")"
Next
Next

Something has to be wrong with the Definition of Cell2 ( Cell2 = """ &
Cell & """), but I can't figure out how to get around it. And I
definitly don't want to manually change 500 cells myself. :-(

Anyone?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Getting " into a String

I assume you want to end up with =Indirect("Sheet1!A1")
as an example.
so use

Cell2 = Cell & """"
ActiveCell.Formula = "=indirect(""Sheet1!" & Cell2 & ")"

to demo from the immediate window:

cell = "B9"
Cell2 = Cell & """"
? cell2
B9"

? "=indirect(""Sheet1!" & Cell2 & ")"
=indirect("Sheet1!B9")

--
Regards,
Tom Ogilvy


"Dan Jansen" wrote:

I have been trying to write a small help to get an indirect formula
into Sheet2. Problem is that the indirect formula needs to have the "
in it: =indirect(Sheet1!"A1"). what I tried to do is this

Dim Cell As String
Dim Cell2 As String
Dim Teller As Integer
Dim Letterteller As Integer

For Letterteller = 1 To 5
If Letterteller = 1 Then Letter = "A"
If Letterteller = 2 Then Letter = "B"
If Letterteller = 3 Then Letter = "C"
If Letterteller = 4 Then Letter = "D"
If Letterteller = 5 Then Letter = "E"

For Teller = 1 To 100
Cell = Letter & Teller
Cell2 = """ & Cell & """
ActiveCell.Formula = "=indirect(Sheet1!" & Cell2 & ")"
Next
Next

Something has to be wrong with the Definition of Cell2 ( Cell2 = """ &
Cell & """), but I can't figure out how to get around it. And I
definitly don't want to manually change 500 cells myself. :-(

Anyone?


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
=SUBSTITUTE(C4,"~?#","") will this work to remove multiple string Raja Mahendiran S Excel Worksheet Functions 6 May 12th 10 09:10 PM
Converting "uppercase" string data to "lower case" in CSV file [email protected] Excel Discussion (Misc queries) 2 August 12th 08 08:36 PM
text string: "91E10" in csv file auto converts to: "9.10E+11" [email protected] Excel Discussion (Misc queries) 2 August 12th 08 03:13 PM
Converting string "061123" into a date "23/11/06" WhytheQ Excel Programming 3 November 24th 06 11:41 AM
Making "examp le" become "examp_le" in a string Sworkhard Excel Programming 3 October 29th 04 09:31 PM


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