Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Ranges are objects. .Value (for a single cell range) will be a simple string or
double. Dim rngNetwork as Range Set rngNetwork _ = Workbooks("UserForm_training").Sheets("backendinfo ").Range("F11").Value Should be: Dim rngNetwork as Range Set rngNetwork _ = Workbooks("UserForm_training").Sheets("backendinfo ").Range("F11") Or Dim rngNetwork as Long 'or string rngNetwork _ = Workbooks("UserForm_training").Sheets("backendinfo ").Range("F11").Value ======== And for the workbook lines, you can't include the full path. It's just the workbook name of that open file. Dim wrkbkUrl1 As Workbook Set wrkbkUrl1 = Workbooks("1 Network.xls") On the other hand, if the workbook isn't open, you'd use: Dim wrkbkUrl1 As Workbook Set wrkbkUrl1 = Workbooks.open _ (filename:="P:\VBA training\Excel templates for Network stats\1 Network.xls") ========= Debra Dalgleish has a list of books at her site: http://www.contextures.com/xlbooks.html John Walkenbach's is a nice one to start with. Daminc wrote: Code so far: Code: -------------------- Option Explicit Public Sub UserForm_Initialize() Dim rngNetwork As Range Dim strNetwork1 As Range Dim strNetwork2 As Range Dim strNetwork3 As Range Dim wrkbkUrl1 As Workbook Dim wrkbkUrl2 As Workbook Dim wrkbkUrl3 As Workbook Set rngNetwork = Workbooks("UserForm_training").Sheets("backendinfo ").Range("F11").Value Set strNetwork1 = Workbooks("UserForm_training").Sheets("backendinfo ").Range("I11").Value Set strNetwork2 = Workbooks("UserForm_training").Sheets("backendinfo ").Range("I12").Value Set strNetwork3 = Workbooks("UserForm_training").Sheets("backendinfo ").Range("I13").Value Set wrkbkUrl1 = Workbooks("P:\VBA training\Excel templates for Network stats\1 Network.xls") Set wrkbkUrl2 = Workbooks("P:\VBA training\Excel templates for Network stats\2 Network.xls") Set wrkbkUrl3 = Workbooks("P:\VBA training\Excel templates for Network stats\3 Network.xls") 'P:\VBA training\Excel templates for Network stats\UserForm_training\backendinfo End Sub -------------------- I've come across about 6 different error types trying to work this out. Anything blatently wrong? Any hints or nudges in the right direction ![]() -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 -- Dave Peterson |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Do you know what? That is one of the clearest explainations that I've come across. At the moment I've got: - Introductory Visual Basic (P.K.McBride) - Excel 2000 Bible - Excel VBA Macro Programming (Richard Shepherd) - The VBA help files - Tutorials from across the web and none of them gives a clear explaination :( I shall check out the book you've mentioned. Cheers Dave -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Do you know what? That is one of the clearest explainations that I've come across. At the moment I've got: - Introductory Visual Basic (P.K.McBride) - Excel 2000 Bible - Excel VBA Macro Programming (Richard Shepherd) - The VBA help files - Tutorials from across the web and none of them gives a clear explaination :( I shall check out the book you've mentioned. Cheers Dave -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If you can get to a library/bookstore, you may want to take a copy of Debra's
list. Then you can pick out the book that seems to fit you best. Daminc wrote: Do you know what? That is one of the clearest explainations that I've come across. At the moment I've got: - Introductory Visual Basic (P.K.McBride) - Excel 2000 Bible - Excel VBA Macro Programming (Richard Shepherd) - The VBA help files - Tutorials from across the web and none of them gives a clear explaination :( I shall check out the book you've mentioned. Cheers Dave -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() I've printed of a copy of those books and I sent a copy to my boss just in case :) -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() With regards to: Set wrkbkUrl1 = Workbooks.open _ (filename:="P:\VBA training\Excel templates for Network stats\1 Network.xls") can I attach a name (i.e. wrkbkUrl1) to a workbook without opening it? I want to use it later on for example: If x=1 then wrkbkUrl1.open elseif x=2 then wrkbkUrl2.open end if or something like that? I though it might be : Set wrkbkUrl1 = Workbooks(filename:="P:\VBA training\Excel templates for Network stats\1 Network.xls") but it doesn't work :( -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
if x = 1 then
set wrkbkurl1 = workbooks.open(filename:="P:\VBA training....\....xls") elseif xl = 2 set wkrkburl2 = workbooks.open(filename:="yourother path here") end if Daminc wrote: With regards to: Set wrkbkUrl1 = Workbooks.open _ (filename:="P:\VBA training\Excel templates for Network stats\1 Network.xls") can I attach a name (i.e. wrkbkUrl1) to a workbook without opening it? I want to use it later on for example: If x=1 then wrkbkUrl1.open elseif x=2 then wrkbkUrl2.open end if or something like that? I though it might be : Set wrkbkUrl1 = Workbooks(filename:="P:\VBA training\Excel templates for Network stats\1 Network.xls") but it doesn't work :( -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 -- Dave Peterson |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() Cheers Dave :) -- Daminc ------------------------------------------------------------------------ Daminc's Profile: http://www.excelforum.com/member.php...o&userid=27074 View this thread: http://www.excelforum.com/showthread...hreadid=501108 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Long IF Statement | Excel Discussion (Misc queries) | |||
If statement | Excel Discussion (Misc queries) | |||
Do I need a sumif or sum of a vlookup formula? | Excel Worksheet Functions | |||
IF Statement nightmare | Excel Discussion (Misc queries) | |||
How do I fix a circular reference in a financial statement? | Excel Discussion (Misc queries) |