ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to code it in macro? (https://www.excelbanter.com/excel-programming/440852-how-code-macro.html)

Eric

How to code it in macro?
 
Does anyone have any suggestions on how to code it in macro?
If cell A1 = B1 under ABC sheet on DEF.xls file, then process following
code, then nothing.
Does anyone have any suggestions on how to code and retrieve value from this
specific cells?
Thanks in advance for any suggestions
Eric

joel[_814_]

How to code it in macro?
 

Set Databk = workbooks.open(filename:="c:\temp\DEF.xls")
Set Datasht = Databk.sheets("ABC")

with Datasht
if .Range("A1") = .Range("B1") then
'add your code here
end if

end With

Databk.close savechanges:=false


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=189250

http://www.thecodecage.com/forumz/chat.php


Eric

How to code it in macro?
 
Will it be possible to retrieve the value without opening the worksheet?
Thank you very much for any suggestions
Eric

"joel" wrote:


Set Databk = workbooks.open(filename:="c:\temp\DEF.xls")
Set Datasht = Databk.sheets("ABC")

with Datasht
if .Range("A1") = .Range("B1") then
'add your code here
end if

end With

Databk.close savechanges:=false


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=189250

http://www.thecodecage.com/forumz/chat.php

.


joel[_819_]

How to code it in macro?
 

there are only two way s of getting data out of a workbook without
opening the workbook.

1) Add a formula to a worksheet. You can do this with a macro.
2) Red/Write data to the workbook like a database using the ADO
method. This uses the Access Database library functions. This
technicaly doesn't open the file but make a connection to the file. You
can have multiple people working on the same workbook simulataneously.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=189250

http://www.thecodecage.com/forumz/chat.php



All times are GMT +1. The time now is 07:19 AM.

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