Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Searching quicker within long dropdownlist | Excel Worksheet Functions | |||
Searching long data base list. | Excel Worksheet Functions | |||
Searching Text that contains particular WORDS. | Excel Worksheet Functions | |||
Replace a long list of abbreviations with full words in Excel | Excel Worksheet Functions | |||
Searching for a words in a column from a list of words. | Excel Programming |