Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default SET statement tutorial

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   Report Post  
Posted to microsoft.public.excel.misc
Daminc
 
Posts: n/a
Default SET statement tutorial


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   Report Post  
Posted to microsoft.public.excel.misc
Daminc
 
Posts: n/a
Default SET statement tutorial


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   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default SET statement tutorial

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   Report Post  
Posted to microsoft.public.excel.misc
Daminc
 
Posts: n/a
Default SET statement tutorial


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   Report Post  
Posted to microsoft.public.excel.misc
Daminc
 
Posts: n/a
Default SET statement tutorial


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   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default SET statement tutorial

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   Report Post  
Posted to microsoft.public.excel.misc
Daminc
 
Posts: n/a
Default SET statement tutorial


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
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
Long IF Statement rmitchell87 Excel Discussion (Misc queries) 2 October 2nd 05 03:50 AM
If statement Matt Montagliano Excel Discussion (Misc queries) 1 September 8th 05 08:47 PM
Do I need a sumif or sum of a vlookup formula? PeterB Excel Worksheet Functions 0 June 1st 05 12:23 PM
IF Statement nightmare eugenevr Excel Discussion (Misc queries) 6 May 18th 05 01:09 PM
How do I fix a circular reference in a financial statement? drjayhawk25 Excel Discussion (Misc queries) 0 February 7th 05 05:19 PM


All times are GMT +1. The time now is 04:38 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"