lookup relative sheet name
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this 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 » Lookup relative to sheet name

Lookup relative to sheet name

resolvedResolved · High Priority · Version 2007

replyReplyTue 16 Mar 2010, 09:57Delegate Tom said...

Lookup relative to sheet name

Hello!

I am writing a module to get excel to use VLOOKUP to get data relative to the name of a current sheet. Please see code. Can you advise why it comes up with an error? (Is it not possible to attach files in questions)?

It is the line shtName = ActiveSheet.Name
that it doesnt like. By the way, other aspects of writing this routine have gone quite well!

Option Explicit

Option Compare Text

Dim intSheetCount As Integer
Dim shtSheet As Worksheet
Dim shtName As String
Dim numRows As Integer

Sub post()

Sheets("FLAT A").Select

For intSheetCount = 1 To 3

shtName = ActiveSheet.Name

numRows = Range("a33").CurrentRegion.Rows.Count

Sheets(intSheetCount + 9).Cells(numRows + 33, 1).Value = Sheets("demands data").Range("a1").Cells(2, 2).Value
Sheets(intSheetCount + 9).Cells(numRows + 33, 2).Value = Sheets("demands data").Range("a1").Cells(3, 2).Value
Sheets(intSheetCount + 9).Cells(numRows + 33, 4).Value = "=VLOOKUP(""shtName"",input,2)"


Next intSheetCount

End Sub

For upcoming training course dates see: Pricing & availability

replyReplyWed 17 Mar 2010, 11:30Trainer Stephen said...

RE: lookup relative to sheet name

Hi Tom

Thanks for your question

It would indeed be handy for me to see the file. Please email it to me at sw. I will then get beack to you on this thread.

Regards

Stephen

 

 

Please browse our web site to find out more about
exce+training and other Microsoft training courses.

Excel tip:

Activating the formula bar with the keyboard in Excel 2010

The formula bar in Excel 2010 contains a number of different formulas. However, it is time consuming to open the formula bar every time and insert the formula using the mouse. Instead, you can activate the formula bar with the keyboard. Simply press the F2 button on the keyboard then the information in the cell will expand allowing you to edit the information in the cell.

View all Excel hints and tips

forum postHi,

I am interested to see how I can open files (saved in a certain location with a given name) and move data from one file to another.

Thanks

» Forum post: VBA Code - Working with multiple files


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training