exceeding characters
The UK's Number 1 for Microsoft Office Training Add this page to your favourites/bookmarksBookmark page
 
View printable version of pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Exceeding Characters

Exceeding Characters

resolvedResolved · Urgent Priority · Version 2003

replyReply Mon 14 Apr 2008, 15:58Delegate Rebecca said...

Rebecca has attended:
Excel Advanced course

Exceeding Characters

Hi,

I have written a code that looks at a specific cell reference in a datasheet.

The lines that contain the specific cell reference are then moved to their own individual worksheet within the same workbook.

The new worksheet is then re-named as the cell reference, however some names exceed the 31 characters allowed to rename a worksheet.

Can you tell me how to resolve the problem

Many thanks

Becky

For upcoming training course dates see: Pricing & availability

replyReply Wed 21 May 2008, 15:36Trainer Stephen said...

RE: Exceeding Characters

Hi Rebecca

Thank you for your question

First let me aplologise for the delay in replying to your question. We have had very high volumes of posts and as a result there have been a number of delays in responding questions.

Assuming you haven't already resolved the issue, can I suggest you email me a copy of the workbook to stephenATmicrosofttraining.net and I will consider the problem as a matter of urgency

Regards

Stephen

replyReply Thu 22 May 2008, 15:42Delegate Rebecca said...

RE: Exceeding Characters

Good afternoon Stephen,
Many thanks for your help with my code regarding excedding the maimum name length for worksheets. I have used the code you sent me which is naming the worksheets within the characters permitted, however from the "C&1" report isn't coming across, the sheet just remains blank and I can't find the problem with it!!!

Would it be possible to help me anymore on this one??
Many thanks
Becky

replyReply Thu 22 May 2008, 10:44 Edited on Thu 22 May 2008, 10:45Trainer Stephen said...

RE: Exceeding Characters

Hi Rebecca

Thanks for your question and for the file

I have looked at the problem, and the first thing to state is that you cannot exceed the maximum name length and therefore you need a strategy for naming your sheets. As any company name that exceeds the maximum length will comprise two or more words, I suggest just using the first word of the name as the sheet title. For example "Best Training", would become be titled "Best".

I have modified your AskForSupplier procedure as follows

Sub AskForSupplier()


Dim intLength As Integer
Dim strTitle As String


Call DeleteSheetIfExists


Worksheets.Add after:=Worksheets(Worksheets.Count)

intLength = Application.WorksheetFunction.Find(" ", txtSupplier)

strTitle = Left(txtSupplier, intLength)

ActiveSheet.Name = strTitle
Sheets("C&I").Select

End Sub


The strategy is to use the worksheet function FIND to locate the first space in the supplier name, and then to use this in the VBA function LEFT, to trim off the first name and set it equal to the variable strTitle.

Hope this is useful

If this strategy is not suitable please let me know so we can explore other options

Regards

Stephen

 

Please browse our web site to find out more about
vba-excel-training and other Microsoft training courses.

Excel tip:

Creating a range of monthly payments as text

You could use a formula to create a range of payment ie. payment amount for x% to y% rate with fixed terms and principle.

The text that would be "between Xamount and Yamount".

Here is how to do it.

1 Use the PMT function to get your monthly payments figure or whatever frequency of payments that you choose he start range.

See PMT under Excel Help

2. Nest these in the ROUND function to round decimals see ROUND under Excel Help


3. Concatenate this using "&" and concatenate " to " and concatenate "Between ".

4. Concatenate the above to PMT function for the end range

ie.

="Between "&ROUND((PMT1),decimal places)&" and "&ROUND((PMT2),decimal places)

View all Excel hints and tips


Microsoft Certified Partner Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses Security Seal verified by visa, mastercard securecard