Hello gentlemen, hopefully I can draw on your expertise again
Thank you sincerely in advance! Starting with the easiest:
1) I know we can get the size of an external file, but could we also open up an external file from VBE, e.g. a movie? From what I've Googled so far, the Shell function seems to be appropriate for the task.
2) Recall that ActiveWindow.DisplayGridlines = False can turn off gridlines in a worksheet. I was just curious, is ActiveWindow an object or a property (that returns an object, i.e. DisplayGridLines)?
3) So with some common sense, I notice you can name a specified range (i.e. right click). So, is there a formal way to undo it, or in other words, is there a list of named ranges, just like how we can access our macros from alt+F8?
4) And finally, my real question
So with some common sense again (and F1), one can easily use VLOOKUP from the worksheet itself (no VBE). But I'm having trouble using VLOOKUP from VBE due to getting a run-time error; for example:
Suppose Sheet1 has two columns, "Item#" and its corresponding "Price". Recall that if the Item# column is sorted (ascending) and we specify a range, we can easily use VLOOKUP to determine the corresponding Price for the desired Item. I believe this specified range/table_array can include the identifying top labels if you like. For example:
Item# Price
03_____ 2
18_____ 3.99
56_____ 1.5
66_____ 5
75_____ 5.2
94_____ 4
(Item# is @ A1)
My flawed attempt:
Maybe PartNum shouldn't have replaced Item, but I think there are some other issues that I have yet to uncover after playing around with the variables. Anyhow, any help with a clean fix or alternative will be appreciated! Cheers!
Thank you sincerely in advance! Starting with the easiest:
1) I know we can get the size of an external file, but could we also open up an external file from VBE, e.g. a movie? From what I've Googled so far, the Shell function seems to be appropriate for the task.
2) Recall that ActiveWindow.DisplayGridlines = False can turn off gridlines in a worksheet. I was just curious, is ActiveWindow an object or a property (that returns an object, i.e. DisplayGridLines)?
3) So with some common sense, I notice you can name a specified range (i.e. right click). So, is there a formal way to undo it, or in other words, is there a list of named ranges, just like how we can access our macros from alt+F8?
4) And finally, my real question
So with some common sense again (and F1), one can easily use VLOOKUP from the worksheet itself (no VBE). But I'm having trouble using VLOOKUP from VBE due to getting a run-time error; for example:
Suppose Sheet1 has two columns, "Item#" and its corresponding "Price". Recall that if the Item# column is sorted (ascending) and we specify a range, we can easily use VLOOKUP to determine the corresponding Price for the desired Item. I believe this specified range/table_array can include the identifying top labels if you like. For example:
Item# Price
03_____ 2
18_____ 3.99
56_____ 1.5
66_____ 5
75_____ 5.2
94_____ 4
(Item# is @ A1)
My flawed attempt:
Rich (BB code):
Sub DeterminePrice()
'comments denote optional code
Dim PartNum 'As Variant
Dim Price As Double
PartNum = InputBox("Enter the Item #")
'WorkSheets("Sheet1").Activate
Price = WorksheetFunction.VLookup(PartNum, Range("A1:B7"), 2, False)
MsgBox PartNum & " costs " & Price
End Sub
Last edited: