Friday, October 30, 2009

Microsoft Excel VBA : how to use a variable in a Range() and how to pull web date into a cell?

1. Normally we use the format Range(%26quot;A1%26quot;) for example. if my colum and row is calculate variables, how do I use it? I would like to do something like Range(%26quot;VariableColumn%26quot;,%26quot;VariableRow%26quot;)



2. If I have a cell, or a dialogue box label with information that I want to look up from a web and pull in from a webpage or a hosted file. I could I do it?



thanks!



Microsoft Excel VBA : how to use a variable in a Range() and how to pull web date into a cell?





1. Instead of Range(%26quot;A1%26quot;)



Use string manipulation functions to build a string



Then use:



astr = %26quot;A1%26quot;



Range(astr)



2. You generally can%26#039;t extract specific targeted information from a web-page. But, here is some general information on web-data access:



http://msdn.microsoft.com/library/defaul...



Microsoft Excel VBA : how to use a variable in a Range() and how to pull web date into a cell?



thanks guys! Report It



Other Replys:About 1 you have several choices



A) Use the Cells instead of Range, that is



Sheet1.Cells( x, y). value



B) You still can yse Range but with Offset methodm that is



Sheet1.Range( %26quot;A1%26quot;). offset( x1, y1). value



C) You can use Range like this



Sheet1.Range( Chr( 65 ) %26amp; 3). value



to get the value of cell A3



Now About 2, you may need to create some macro to read the HTML document (Web page) from the history, and get what ever you want



Read my profile, I am the XLMan

No comments:

Post a Comment

 

Web hosting service Copyright 2008 All Rights Reserved Baby Blog Designed by Ipiet | Web Hosting