Getting away from SENDKEYS


Posted by bill roberts on February 14, 2000 8:45 AM

I’ve imported a series of perhaps 59,000 records.

My job now is to normalize the data for later import into MSACCESS.

Not only are records variable length, they are also multiple line!

No problem.

First field of each record has a unique string.

Unfortunately, some “A” COLUMN entries were interpreted as formulas.

My IF’s bomb out whenever they run across this trash.

I could build more security into the IF yet since I must deal with this RIFF-RAFF later, choose to set the COLUMN to text and then line-by-line process it into TEXT.

PHASE ONE:

1) Set VARIABLE to search string
2) Determine last row.
3) Set COLUMN A to format TEXT
4) Use FOR/NEXT to assume each cell as TEXT. Used SendKeys "{F2}{ENTER}", 1

As I have an enormous amount of data, this procedure is quite time consuming.

I WANT TO GET AWAY FROM SENDKEYS!!! Not only is it easier for others my logic (and therefore undermine my importance), It acts on the entire windows environment.

I cannot do anything else while this macro is running.


PHASE TWO consolidated all information.

PHASE THREE will combine multiple records

PHASE FOUR will remove unneeded data.

PHASE FIVE will ‘probably’ parse data into more manageable chunks for data transport into ACCESS.

So, how do I get away from SENDKEYS?

I must EDIT (using F2) and then hit ENTER.

Bill

Posted by Chris on February 14, 2000 11:12 AM

Bill,

IF F2/Enter is all you need, you should be able to accomplish the same thing with:

activecell.value = activecell.value

Or, if you are using a for next:

For Each cell in selection
cell.value = cell.value
next cell

HTH,
Chris

Posted by bill roberts on February 14, 2000 12:14 PM

Thanks but it didn't work.

Because the cell in question produced an error, the macro took the error message as the cell contents and consequently wiped out the formula

Any other ideas?




Posted by bill roberts on February 14, 2000 1:12 PM

CHRIS!!!

Eureka!!

I found a reference on the MSDN site.

Instead of:

ActiveCell.Value = ActiveCell.Value

Use:

ActiveCell.Formula = ActiveCell.Formula

Thank you for at least getting me on the right track!

Bill Bill, IF F2/Enter is all you need, you should be able to accomplish the same thing with: activecell.value = activecell.value Or, if you are using a for next: For Each cell in selection