Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default External Data

I need some help with Excel VBA, currently I have the following line
of code:

PeakCPU = Application.VLookup(ServerName, Workbooks(Workbook).Sheets
("Server_Utilisation").Range("$C$25:$L$8100"), 7, False)

This looks for a string in an already open spreadsheet but I'm running
out of memory due to the number of spreadsheets I am working with.
What I want to do is amend this so it will look for the data in a
spreadsheet that is not open but stored on my C drive.

Please advise how I need to amend the formula, I believe this is
possible but can't find any examples.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default External Data

david,

You can't Vlookup a closed workbook in Vb but it works OK as a worksheet
formula. use a worksheet Vlookup on the closed workbook and capture the cell
value in your VB code.

Mike

"David" wrote:

I need some help with Excel VBA, currently I have the following line
of code:

PeakCPU = Application.VLookup(ServerName, Workbooks(Workbook).Sheets
("Server_Utilisation").Range("$C$25:$L$8100"), 7, False)

This looks for a string in an already open spreadsheet but I'm running
out of memory due to the number of spreadsheets I am working with.
What I want to do is amend this so it will look for the data in a
spreadsheet that is not open but stored on my C drive.

Please advise how I need to amend the formula, I believe this is
possible but can't find any examples.

Thanks.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default External Data

You can put in a formula from a closed wb and use that. However, be advised
that Excel does not like large external fields such as your 8100. Makes it
very slow to say the least. Perhaps your field is smaller or you can break
it up into blocks.

Sub lookupinclosedwb()
With Range("i1")'use an unused cell
.Formula = "=vlookup(""value"",[wb.xls]sheet!c25:L8100,7,0)"
MsgBox .Value
PeakCPU =.value
.ClearContents
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"David" wrote in message
...
I need some help with Excel VBA, currently I have the following line
of code:

PeakCPU = Application.VLookup(ServerName, Workbooks(Workbook).Sheets
("Server_Utilisation").Range("$C$25:$L$8100"), 7, False)

This looks for a string in an already open spreadsheet but I'm running
out of memory due to the number of spreadsheets I am working with.
What I want to do is amend this so it will look for the data in a
spreadsheet that is not open but stored on my C drive.

Please advise how I need to amend the formula, I believe this is
possible but can't find any examples.

Thanks.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default External Data

Or, you may like to make a defined name in your destination workbook
referring to the source.
insertnamedefinename it sourcebookin the refers to box. Here you DO need
the $
=[wb.xls]sheet!$c$25:$L$8100
then
=VLookup(value,sourcebook,7,0)
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message
...
You can put in a formula from a closed wb and use that. However, be
advised that Excel does not like large external fields such as your 8100.
Makes it very slow to say the least. Perhaps your field is smaller or you
can break it up into blocks.

Sub lookupinclosedwb()
With Range("i1")'use an unused cell
.Formula = "=vlookup(""value"",[wb.xls]sheet!c25:L8100,7,0)"
MsgBox .Value
PeakCPU =.value
.ClearContents
End With
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"David" wrote in message
...
I need some help with Excel VBA, currently I have the following line
of code:

PeakCPU = Application.VLookup(ServerName, Workbooks(Workbook).Sheets
("Server_Utilisation").Range("$C$25:$L$8100"), 7, False)

This looks for a string in an already open spreadsheet but I'm running
out of memory due to the number of spreadsheets I am working with.
What I want to do is amend this so it will look for the data in a
spreadsheet that is not open but stored on my C drive.

Please advise how I need to amend the formula, I believe this is
possible but can't find any examples.

Thanks.



Reply
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
External Data Warning Message - I have No External Data in wrkbk Cass_makeitfun[_2_] Excel Discussion (Misc queries) 0 May 12th 10 09:02 PM
Getting External Data based on criteria insde of the external data BigMacExcel Excel Discussion (Misc queries) 0 August 31st 09 06:41 PM
Excel Macro for taking data external data and populating it on a sheet and deleting unwanted data [email protected] Excel Programming 3 November 8th 07 05:59 AM
insert entire row for new data, external data range doesnt work orlya1 Excel Programming 3 April 3rd 06 08:39 PM
Need advice : consolidating data from multiple CSV files in Excel - External data handling Matthieu Gaillet Excel Programming 0 December 1st 05 09:02 AM


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

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

About Us

"It's about Microsoft Excel"