Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Searching long words

Hi all,

Just a quick query. I have a macro, which searches through column B o
a spreadhseet and creates new sheets according to the content of th
cell. However, it doesn't accept any cell, which contains more than 3
characters. What should I use in my declaration so that it accepts lon
words?

Cheer

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Excel VBA - Searching long words

Well, I'm guessing, but 31 characters is the maximum length of the sheet
name, so that may be the thing blocking you.

--
Regards,

Juan Pablo González

"ozcank " wrote in message
...
Hi all,

Just a quick query. I have a macro, which searches through column B of
a spreadhseet and creates new sheets according to the content of the
cell. However, it doesn't accept any cell, which contains more than 31
characters. What should I use in my declaration so that it accepts long
words?

Cheers


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA - Searching long words

Good thinking, I neglected that small factor. I have the following code
which selects the name of the cell:

Private Sub getNames()
Dim intRow As Integer, wsMain As Worksheet
Dim strReadName As String

Set wsMain = ActiveWorkbook.Worksheets("ufioverdue")
intIdx = 0
intRow = 2
With wsMain
Do
strReadName = .Cells(intRow, 2)
strNames(intIdx) = strReadName

Do
intRow = intRow + 1
Loop Until strReadName < .Cells(intRow, 2)

intIdx = intIdx + 1

Loop While .Cells(intRow, 2) < ""
End With
intIdx = intIdx - 1

End Sub

What would I have to alter so that it would only select the first 3
characters of a cell? ny ideas?

Cheer

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default Excel VBA - Searching long words

Try changing

..Cells(intRow, 2)

with

Left$(.Cells(intRow, 2).Value, 31)

--
Regards,

Juan Pablo González

"ozcank " wrote in message
...
Good thinking, I neglected that small factor. I have the following code,
which selects the name of the cell:

Private Sub getNames()
Dim intRow As Integer, wsMain As Worksheet
Dim strReadName As String

Set wsMain = ActiveWorkbook.Worksheets("ufioverdue")
intIdx = 0
intRow = 2
With wsMain
Do
strReadName = .Cells(intRow, 2)
strNames(intIdx) = strReadName

Do
intRow = intRow + 1
Loop Until strReadName < .Cells(intRow, 2)

intIdx = intIdx + 1

Loop While .Cells(intRow, 2) < ""
End With
intIdx = intIdx - 1

End Sub

What would I have to alter so that it would only select the first 31
characters of a cell? ny ideas?

Cheers


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Excel VBA - Searching long words

sStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw xyz"
sStr1 = Left(sStr,31)
? sStr
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx yz
? sStr1
ABCDEFGHIJKLMNOPQRSTUVWXYZabcde


--
Regards,
Tom Ogilvy

"ozcank " wrote in message
...
Good thinking, I neglected that small factor. I have the following code,
which selects the name of the cell:

Private Sub getNames()
Dim intRow As Integer, wsMain As Worksheet
Dim strReadName As String

Set wsMain = ActiveWorkbook.Worksheets("ufioverdue")
intIdx = 0
intRow = 2
With wsMain
Do
strReadName = .Cells(intRow, 2)
strNames(intIdx) = strReadName

Do
intRow = intRow + 1
Loop Until strReadName < .Cells(intRow, 2)

intIdx = intIdx + 1

Loop While .Cells(intRow, 2) < ""
End With
intIdx = intIdx - 1

End Sub

What would I have to alter so that it would only select the first 31
characters of a cell? ny ideas?

Cheers


---
Message posted from http://www.ExcelForum.com/



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
Searching quicker within long dropdownlist Blackbird Excel Worksheet Functions 1 March 10th 09 04:54 PM
Searching long data base list. vvsmith Excel Worksheet Functions 2 November 6th 07 07:23 PM
Searching Text that contains particular WORDS. Abdullah Kajee Excel Worksheet Functions 9 August 27th 07 07:52 AM
Replace a long list of abbreviations with full words in Excel jgundel Excel Worksheet Functions 3 February 7th 06 07:11 PM
Searching for a words in a column from a list of words. Scott Excel Programming 5 August 15th 03 02:40 PM


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