PC Review


Reply
Thread Tools Rate Thread

Added apostrophes from VBA to Excel??

 
 
=?Utf-8?B?Ymxl?=
Guest
Posts: n/a
 
      7th Jun 2007
Does anyone know why this code

ActiveCell.FormulaR1C1 = "=HLOOKUP(A20,RC[1]:RC[100],1,FALSE)"

becomes this in the cell once inserted

=HLOOKUP('A20',RC[1]:RC[100],1,FALSE)

and the "added" apostrophes to cell ref 'A20' instead of A20 prevent the A20
text from being found by the HLOOKUP. If after inserted I manually remove
the apostrophes, the command works properly. How can I prevent VBA from
adding these apostrophes??
 
Reply With Quote
 
 
 
 
NickHK
Guest
Posts: n/a
 
      7th Jun 2007
I would assume because you are using the FormulaR1C1 property, but using and
absolute address.
Maybe something like:

Dim RelRangeAdd As String

RelRangeAdd = Range("A20").Address(, , xlR1C1)
ActiveCell.FormulaR1C1 = "=HLOOKUP(" & RelRangeAdd &
",RC[1]:RC[100],1,FALSE)"

NickHK

"ble" <(E-Mail Removed)> ¼¶¼g©ó¶l¥ó·s»D:96D0CA77-B93F-45F7-BFDF-(E-Mail Removed)...
> Does anyone know why this code
>
> ActiveCell.FormulaR1C1 = "=HLOOKUP(A20,RC[1]:RC[100],1,FALSE)"
>
> becomes this in the cell once inserted
>
> =HLOOKUP('A20',RC[1]:RC[100],1,FALSE)
>
> and the "added" apostrophes to cell ref 'A20' instead of A20 prevent the
> A20
> text from being found by the HLOOKUP. If after inserted I manually remove
> the apostrophes, the command works properly. How can I prevent VBA from
> adding these apostrophes??



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      7th Jun 2007
ActiveCell.FormulaR1C1 = "=HLOOKUP(r20c1,RC[1]:RC[100],1,FALSE)"



ble wrote:
>
> Does anyone know why this code
>
> ActiveCell.FormulaR1C1 = "=HLOOKUP(A20,RC[1]:RC[100],1,FALSE)"
>
> becomes this in the cell once inserted
>
> =HLOOKUP('A20',RC[1]:RC[100],1,FALSE)
>
> and the "added" apostrophes to cell ref 'A20' instead of A20 prevent the A20
> text from being found by the HLOOKUP. If after inserted I manually remove
> the apostrophes, the command works properly. How can I prevent VBA from
> adding these apostrophes??


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?Ymxl?=
Guest
Posts: n/a
 
      8th Jun 2007
Thanks much, couldn't get to your response yesterday (problem with my
profile?), looked harder at other posts and discussions of R1C1, used
something like you suggested, once I understood R1C1.
--
ble


"NickHK" wrote:

> I would assume because you are using the FormulaR1C1 property, but using and
> absolute address.
> Maybe something like:
>
> Dim RelRangeAdd As String
>
> RelRangeAdd = Range("A20").Address(, , xlR1C1)
> ActiveCell.FormulaR1C1 = "=HLOOKUP(" & RelRangeAdd &
> ",RC[1]:RC[100],1,FALSE)"
>
> NickHK
>
> "ble" <(E-Mail Removed)> ¼¶¼g©ó¶l¥ó·s»D:96D0CA77-B93F-45F7-BFDF-(E-Mail Removed)...
> > Does anyone know why this code
> >
> > ActiveCell.FormulaR1C1 = "=HLOOKUP(A20,RC[1]:RC[100],1,FALSE)"
> >
> > becomes this in the cell once inserted
> >
> > =HLOOKUP('A20',RC[1]:RC[100],1,FALSE)
> >
> > and the "added" apostrophes to cell ref 'A20' instead of A20 prevent the
> > A20
> > text from being found by the HLOOKUP. If after inserted I manually remove
> > the apostrophes, the command works properly. How can I prevent VBA from
> > adding these apostrophes??

>
>
>

 
Reply With Quote
 
=?Utf-8?B?Ymxl?=
Guest
Posts: n/a
 
      8th Jun 2007
Thanks, couldn't get to response yesterday, pretty much came to same
conclusion anyway after looking at other posts (should've done before asking).
--
ble


"Dave Peterson" wrote:

> ActiveCell.FormulaR1C1 = "=HLOOKUP(r20c1,RC[1]:RC[100],1,FALSE)"
>
>
>
> ble wrote:
> >
> > Does anyone know why this code
> >
> > ActiveCell.FormulaR1C1 = "=HLOOKUP(A20,RC[1]:RC[100],1,FALSE)"
> >
> > becomes this in the cell once inserted
> >
> > =HLOOKUP('A20',RC[1]:RC[100],1,FALSE)
> >
> > and the "added" apostrophes to cell ref 'A20' instead of A20 prevent the A20
> > text from being found by the HLOOKUP. If after inserted I manually remove
> > the apostrophes, the command works properly. How can I prevent VBA from
> > adding these apostrophes??

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting Query to Excel and Apostrophes Shohoku79 Microsoft Access External Data 2 21st Feb 2008 02:19 AM
"Added apostrophes from VBA to Excel??" response =?Utf-8?B?Ymxl?= Microsoft Excel Programming 0 7th Jun 2007 05:11 PM
apostrophes added to outgoing addresses priorpark17 Microsoft Outlook Discussion 0 11th Feb 2007 05:23 PM
How do I remove leading apostrophes in Excel? =?Utf-8?B?Tmlubw==?= Microsoft Excel Misc 8 13th Dec 2005 12:14 PM
Apostrophes instead of equals in Excel =?Utf-8?B?QVJI?= Microsoft Excel Worksheet Functions 3 20th Aug 2005 12:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 AM.