Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 280
Default 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
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
prevent reading or any access to selected cells R New Users to Excel 2 August 26th 09 10:06 PM
FORMULA READING DATA FROM PIVOT TABLE TO SPREADSHEET Donna Excel Worksheet Functions 0 March 9th 09 06:43 PM
Reading Cells from One Worksheet in another Mike Setting up and Configuration of Excel 2 July 19th 07 08:26 PM
Reading Cells In another worksheet mike Excel Discussion (Misc queries) 1 June 7th 07 03:09 PM
Reading Cells is the same workbook different tab Mike Excel Discussion (Misc queries) 1 June 7th 07 03:08 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"