Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Excel - Read value of cell

Status
Not open for further replies.

nashvillebill

Technical User
Mar 7, 2010
2
US
I working on a project in which I am moving equipment from 400 locations to 400 other locations in the US. I have the longitude and latitude for each of the locations and I'm trying to find the nearest locations to move the equipment to. I'm using a trig formula in Excel 2007 to find the difference between each of the locations. I want to automate the selections and I'm trying to use VBA to do this. I am having trouble selecting the cell that I want to get the data from, so I guess I just need help with the syntax because I'm getting an error 9. Is there a reference to this for VBA that I can find on line?

My workbook has three worksheets: Calculate, 9 Cams and 4 Cams. I want to get the value of a cell in Calculate and delete the row that has that value in 9 Cams.

Thanks in advance,

Bill
 
Hear is some really simple code that returns an error 9 - subscript out of range error.

Private Sub CommandButton1_Click()

Workbooks("Distance Calculator Test").Sheets("Calculate").Range("G2").Font.Bold = True

End Sub
 


Hi,

faq707-4594

This FAQ, will show you how you can discover the answers to many of your questions. Using it on your code, you will find the answer in the Workbooks object.



Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Generally, I have found that "subscript out of range" for something like "Workbooks("Distance Calculator Test").Sheets("Calculate").Range("G2").Font.Bold = True" means that either you don't have a workbook named (exactly) "Distance Calculator Test" or you don't have a sheet named (again, exactly) "Calculate".

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top