Advertisement

06.30.2008 at 04:15PM PDT, ID: 23528674
[x]
Attachment Details

Removing characters from a call that is being populated by code

Asked by jgerardy in Microsoft Excel Spreadsheet Software

The code below is pulling the name from a text file that is open when this macro is running in another open workbook.  I need to limit the name to only the first 3 or 4 letters, or anything before the first _.

TEST_Complete-SF.txt or RLS_Complete-1.txt
should return
TEST  or   RLS  to the Cell A3
The quantity of characters is not consistant
Thanks in advance,
jStart Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
Sub AddSchoolNametoAll()
For i = 1 To Application.Workbooks.Count
    If Application.Workbooks(i).Name <> ActiveWorkbook.Name Then
        Range("A3").Activate
        ActiveCell.Value = Application.Workbooks(i).Sheets(1).Name
           
         Exit Sub
    End If
Next
End Sub
[+][-]06.30.2008 at 04:21PM PDT, ID: 21903814

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.30.2008 at 04:29PM PDT, ID: 21903842

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.30.2008 at 04:41PM PDT, ID: 21903889

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.30.2008 at 04:46PM PDT, ID: 21903912

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Sign Up Now!
Solution Provided By: zorvek
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.30.2008 at 04:47PM PDT, ID: 21903918

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628