Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
reading cells from a spreadsheet using VB
Dan,
The obvious question is does Selection contain more than one c? Step thru the code. Example: Set a breakpoint at the For Each line. Run the code (F5). When it stops at the breakpoint, enter "Print Selection.Cells.Count" into the Immediate window (Ctrl+G) and, with your cursor on the line, hit Enter to see a count of cells in Selection. If it is one (1) and you expect more, find out why. If OK, clear the first break point and set a break point at SendKeys and run the code. When it stops at the next break point, see what the variable values are and compare them to what you expect. Hit run again. Execution should stop at the break point each time thru the loop. If the code never stops at a breakpoint, step into and through the code using F8, checking the state of variables and path of execution as you go. I suggest you declare all variables (declare c as a range) and make it explicit that you want the value of each CELL in Selection. Moreover, go to ToolOptionsEditor. Check 'Require Variable Declaration.' Dim sep as String Dim Content As String Dim c As Range For Each c in Selection.Cells etc. Bob Kilmer "Dan" wrote in message ... I'm trying to read cells from a spreadsheet using VB/macro to automate some data entry on another system. I did this about 4 years ago, I think w/95. I have the code but it's not working with excel 2000, vb6. It only reads the first cell, posts the data to the screen and stops. Any assistance would be greatly appreciated. Here is the code: Sub Send_rows() AppActivate "Application" ' Activate Oracle Applications DoEvents ' <snip |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
prevent reading or any access to selected cells | New Users to Excel | |||
FORMULA READING DATA FROM PIVOT TABLE TO SPREADSHEET | Excel Worksheet Functions | |||
Reading Cells from One Worksheet in another | Setting up and Configuration of Excel | |||
Reading Cells In another worksheet | Excel Discussion (Misc queries) | |||
Reading Cells is the same workbook different tab | Excel Discussion (Misc queries) |