Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Variable-Length String causing error

hi,
i have the following code:

Dim Msg As String
Msg = Msg & "Award Title:" & Cells(r, 9) & vbCrLf

now when i run the marcro, i get the following error:

Run-time error '5':
Invalid procedure call or argument

but when i shorten the title from from 50 characters to
about 15 characters it works fine. is there a limit on
how many characters a string can have, if not why am i
getting this error? any assistance is greatly
appreciated, thanks in advance.

~q
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Variable-Length String causing error

Change it to "Cells(r, 9).Value" and try it again. - Pikus
-----Original Message-----
hi,
i have the following code:

Dim Msg As String
Msg = Msg & "Award Title:" & Cells(r, 9) & vbCrLf

now when i run the marcro, i get the following error:

Run-time error '5':
Invalid procedure call or argument

but when i shorten the title from from 50 characters to
about 15 characters it works fine. is there a limit on
how many characters a string can have, if not why am i
getting this error? any assistance is greatly
appreciated, thanks in advance.

~q
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Variable-Length String causing error

hi,
thanks for replying, i tried changing it, but it still
caused the same error. thank you

**i have the same exact code for cells r, 1-8 and they
work fine, and i interchange 9 with any other column and
it still runs fine, but with 9 in, it returns an error,
except when i cut the characters down to less than 15
characters. i have no idea how to fix it. thanks.
~q

-----Original Message-----
Change it to "Cells(r, 9).Value" and try it again. - Pikus


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Variable-Length String causing error

If you feel comfortable sending me the file I'll be happy
to look at it for you. If you don't send it right away
I'll just have to get back to you tomorrow though. - Pikus

-----Original Message-----
hi,
thanks for replying, i tried changing it, but it still
caused the same error. thank you

**i have the same exact code for cells r, 1-8 and they
work fine, and i interchange 9 with any other column and
it still runs fine, but with 9 in, it returns an error,
except when i cut the characters down to less than 15
characters. i have no idea how to fix it. thanks.
~q

-----Original Message-----
Change it to "Cells(r, 9).Value" and try it again. -

Pikus

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default Variable-Length String causing error

Hi,
Most likely R is not a row number. (probably r=0)
Try this.

Dim Msg As String
msgbox "R=" & r
Msg = Msg & "Award Title:" & Cells(r, 9) & vbCrLf


I just ran this without a problem.

Sub foo()
R = 4
Dim Msg As String
For i = 1 To 50
Msg = Msg & "Award Title:" & Cells(R, 9) & vbCrLf
Next
Debug.Print Msg, Len(Msg)
End Sub

5040 chars.

--

John

johnf202 at hotmail dot com


"Q" wrote in message
...
hi,
thanks for replying, i tried changing it, but it still
caused the same error. thank you

**i have the same exact code for cells r, 1-8 and they
work fine, and i interchange 9 with any other column and
it still runs fine, but with 9 in, it returns an error,
except when i cut the characters down to less than 15
characters. i have no idea how to fix it. thanks.
~q

-----Original Message-----
Change it to "Cells(r, 9).Value" and try it again. - Pikus




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
What's causing error message? Jim Tibbetts Excel Worksheet Functions 4 November 12th 08 06:13 PM
Finding a string of unknown length in a string of unknown length, Help! Hankjam[_2_] Excel Discussion (Misc queries) 8 July 3rd 08 06:49 PM
String length jxbeeman Excel Discussion (Misc queries) 1 January 10th 08 07:01 PM
Sum a column of variable length? Brian Excel Discussion (Misc queries) 5 February 3rd 05 02:26 PM
Error when string length 1024 and starts with - Dianne Excel Programming 3 December 4th 03 07:31 AM


All times are GMT +1. The time now is 06:38 AM.

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"