LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default select different workbook in vba?

i would like this code to point to workbook "test1" instead of ActiveWorkbook.

does this code need rewriten? everything i have tried has not worked. i am
very much a novice at vba. this code works well if the information remains in
the ActiveWorkbook, but for security it needs to be moved.

Private Sub OldPriceLookup()

With ActiveSheet

If .Range("B17").Value = "n/a" Then

' clear out the old price
.Range(sOldPriceCol).Value = ""

ElseIf .Range("B17").Value = "A02" Then

' A02 = 29
' set the old price (only need to change the column Number "29")
.Range(sOldPriceCol).Value =
WorksheetFunction.VLookup(Range("B19").Value,
ActiveWorkbook.Sheets("casing").Range("1:65536"), 29, False)

ElseIf .Range("B17").Value = "A03" Then

' A03 = 30
' set the old price (only need to change the column Number "30")
.Range(sOldPriceCol).Value =
WorksheetFunction.VLookup(Range("B19").Value,
ActiveWorkbook.Sheets("casing").Range("1:65536"), 30, False)

it does have an end, just not shown.

 
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
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
workbook select Nigel Excel Discussion (Misc queries) 3 May 17th 05 08:45 PM
select workbook Tom Excel Programming 6 July 9th 04 02:14 PM
Sheets select method fails when workbook is opened by another workbook Mike Excel Programming 2 June 8th 04 04:17 AM
Select other workbook to select data in a macro. T Tromp Excel Programming 2 September 19th 03 01:43 PM


All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"