ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VLookUp when Macro Opens WorkBooks (https://www.excelbanter.com/excel-programming/308056-re-vlookup-when-macro-opens-workbooks.html)

Tom Ogilvy

VLookUp when Macro Opens WorkBooks
 
Sub Quote()
Dim mybook As Workbook
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "C:\Documents and Settings\Javier\My Documents\Test\"
ChDrive MyPath
ChDir MyPath
FNames = Dir("*.xls")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
Do While FNames < ""
Set mybook = Workbooks.Open(Filename:=FNames, _
UpdateLinks:=0)

mybook.Worksheets(1).Range("D17").Formula = _
"= C17*1.3352"
mybook.Worksheets(1).Range("C25").Formula = _
"=(SUM(B25*F20)/F19)/1.3352"
mybook.Close True
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy

"JavyD" wrote in message
...
It's the popup message box that says this work book contains automatic

links
to information in another work book. Do you want to update this work

book,
bla bla bla, yes or no. That's the message that I have to click no on 400
times.

"sebastienm" wrote:

Hi JavyD,
what VLook Up message ? is it a message displayed by your macro. I can't
think of any vlook message from excel itself.

Regadrs,
Sébastien

"JavyD" wrote:

Hello guys,

I have a macro at the moment, thanks to the help of Tom and Ron. What

it
does it opens up over 400 work books, changes a few cells, then saves

them
and closes them. Now each of these 400 work books, has hundreds of

VLook
Ups. How can I add to this macro more code that when the macro opens

the
report, that the VLook Up message doesnt pop up, and I have to sit

there for
an hour clicking no no no no, dont update?

Regards,




JavyD

VLookUp when Macro Opens WorkBooks
 
Amazing Tom, lets see if it works when I get in the office tomorrow.

"Tom Ogilvy" wrote:

Sub Quote()
Dim mybook As Workbook
Dim FNames As String
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir
MyPath = "C:\Documents and Settings\Javier\My Documents\Test\"
ChDrive MyPath
ChDir MyPath
FNames = Dir("*.xls")
If Len(FNames) = 0 Then
MsgBox "No files in the Directory"
ChDrive SaveDriveDir
ChDir SaveDriveDir
Exit Sub
End If

Application.ScreenUpdating = False
Do While FNames < ""
Set mybook = Workbooks.Open(Filename:=FNames, _
UpdateLinks:=0)

mybook.Worksheets(1).Range("D17").Formula = _
"= C17*1.3352"
mybook.Worksheets(1).Range("C25").Formula = _
"=(SUM(B25*F20)/F19)/1.3352"
mybook.Close True
FNames = Dir()
Loop
ChDrive SaveDriveDir
ChDir SaveDriveDir
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy

"JavyD" wrote in message
...
It's the popup message box that says this work book contains automatic

links
to information in another work book. Do you want to update this work

book,
bla bla bla, yes or no. That's the message that I have to click no on 400
times.

"sebastienm" wrote:

Hi JavyD,
what VLook Up message ? is it a message displayed by your macro. I can't
think of any vlook message from excel itself.

Regadrs,
Sébastien

"JavyD" wrote:

Hello guys,

I have a macro at the moment, thanks to the help of Tom and Ron. What

it
does it opens up over 400 work books, changes a few cells, then saves

them
and closes them. Now each of these 400 work books, has hundreds of

VLook
Ups. How can I add to this macro more code that when the macro opens

the
report, that the VLook Up message doesnt pop up, and I have to sit

there for
an hour clicking no no no no, dont update?

Regards,






All times are GMT +1. The time now is 11:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com