LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Proper Programming

Is the following the corect way to use functions? The following works fine,
however When I look at what the experts do they seem to embellish there code
with remarks like "as Double" "as Integer" "as Variant" and wonder if i
should embellish mine in this way, but, I don't really know what it all
means nor do I see the point in it as code seems to run quite happily
without it?

Anyway, here is some code that I have wrote, it works fine and does the job,
but how should it of been done.

PS. I do really appreciate the help that is freely given by others on this
group, it is invaluable, and take this opportunity to wish you all a very
happy xmas!

Sub KeepImage()
Dim lB1, lB2
lB1 = GetList1Info()
lB2 = GetList2Info()
If lB1 = "" Or lB2 = "" Then Exit Sub
ActiveSheet.Unprotect
With ActiveCell
.Offset(0, 2) = "Yes"
.Offset(0, 3) = lB1
.Offset(0, 4) = lB2
End With
end sub

Private Function GetList1Info()
Dim lBox1 As ListBox
Dim temp, i
Set lBox1 = Sheets("jpegs").ListBoxes("List Box 1")
With lBox1
For i = 1 To .ListCount
If .Selected(i) Then
temp = .List(i)
Exit For
End If
Next i
End With
GetList1Info = temp
End Function

Private Function GetList2Info()
Dim lBox2 As ListBox
Dim temp, i
Set lBox2 = Sheets("jpegs").ListBoxes("List Box 2")
temp = ""
With lBox2
For i = 1 To .ListCount
If .Selected(i) Then
temp = temp & .List(i) & ";"
End If
Next i
End With
GetList2Info = temp
End Function


 
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
=PROPER() Mukesh Excel Discussion (Misc queries) 2 June 6th 09 06:45 AM
Proper !!! Excel Discussion (Misc queries) 8 February 22nd 08 02:17 AM
Not Proper! Adam Excel Worksheet Functions 2 September 19th 07 12:08 PM
proper afdmello Excel Discussion (Misc queries) 3 October 11th 05 09:48 AM
=proper Scrappy[_2_] Excel Programming 3 November 13th 03 09:43 PM


All times are GMT +1. The time now is 05:43 PM.

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"