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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I fix this code to start and stop at each cell

Status
Not open for further replies.

link99sbc

Technical User
Apr 8, 2009
141
US
This code gets the each cell down colA (Numbers) and
puts the data where I want it but it keeps
going. My field looks like a countdown timer.

How do I make it stop after each cell until I'm ready
for the next cell. I need time to research each number
before it puts the next cell of numbers in my field.
And how would I make it start on row 100 one day and row
200 the next day and maybe row 250 the next day or just
start at the active cell.


Dim obj as object
Dim objWorkbook as object
Set obj=CreateObject("Excel.Application")
Set System = CreateObject("EXTRA.System")
Dim Sess As Object
Set Sess = System.ActiveSession

Set obj = Getobject("C:\CODE1.xls") 'where xxxx is the location/name of the file on the C Drive
set objWorkbook=obj.Worksheets("Sheet1")

For i = 2 To obj.ActiveSheet.Rows.Count 'assumption data begins with row 2
MyNumber = objWorkBook.Range("A" & i) 'assumption data begins in column A

If Trim(MyNumber) = "" Then exit sub

sess.screen.putstring MyNumber,4,18 'places the data from Excel in Extra
'do stuff in extra...

next i 'i is the next row


End Sub
 



You modify the code not to loop, but to work, based on the active cell.


Exicute each time you want to run.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 

Do you have a sample code?

Are you oserious? You have code that i8s your "sample code". You cannot figure that out for yourself? Did your try?

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 



Alternatively, you could put a MsgBox to STOP the process, then your either click OK or CANCEL, to continue or quit.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Well I guess if it said (Programer) next to my name instead of (Technical User) I could figure it out. Then I wouldn't have to be here asking stupid questions.
 


If YOU can't, then hire a programmer.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Excellent. If everybody did that then you wouldn't need to be here.
 


No. People here, get tips, take initiative, try stuff and learn.

Take a stab at it. Then report back if and when you need help.

Otherwise, hire a professional.

Skip,
[glasses]Don't let the Diatribe...
talk you to death![tongue]

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
link99SBC,

i have to agree with Skip.
People here, get tips, take initiative, try stuff and learn.

you really shouldn't be snide with comeback remarks. it's counter-productive, IMHO...

i've learned a lot from this board and also a lot from trial and error...

with that said:
And how would I make it start on row 100 one day and row
200 the next day and maybe row 250 the next day or just
start at the active cell.
try something like this...it's a possible solution
Code:
        begRw=InputBox("Enter a row to begin")
        For i = begRw To obj.ActiveSheet.Rows.Count  'data will begin with your input

as for this:
How do I make it stop after each cell until I'm ready
for the next cell. I need time to research each number
before it puts the next cell of numbers in my field.
1. how long does it take to do a research? minutes, hours, days?..etc...i think you can code it to sleep for x time
2. when you are ready for the next cell, is there anything unique on your Extra Session, such as a screen name, co-ordinate position? or maybe a system message??? if there is, then you can write that into your code ...

Take a stab at it. Then report back if and when you need help.

 
I've tried to make this work for over a month. I've gone thru every post, I've tried everything suggested, I've changed code. Nothing works. I can't use a loop macro because I can't run another macro while it's active. I've tried msgbox which won't let me do anything in the session with it's active. Everything else I've tried has a compile error. I cant get extra to recognize the activecell, put it in my field, and make the next cell active. I had programers here suggest the same things you suggested. It doesn't work. So apparently nobody knows. So I'll just quit and go get a Happy Meal.
 
well, after you finish your happy meal,

I can't use a loop macro because I can't run another macro while it's active.

you can call another macro from within a macro.

I cant get extra to recognize the activecell, put it in my field, and make the next cell active
i thought you had it figured out from your previous post over here:
 
Yes but skip says that's no way to write code so I was trying to learn and figure a way to do it like vb code so it would look more professional. They maybe I could find more uses for it. The only VB code I know is what I learned here in the last month.
 
link99sbc,

believe me you will learn a lot more in the months to come as you get your feet wet...a lot can be done with code but you need to keep in mind that there are limitations with extra visual basic. coding in vba is more user friendly and robust. my macros are simple and ugly but it gets the job done.

so now back to your issues:
did you at least try one of my suggestions with the input box? is that not feasible?

and what happens with the extra screen when you are researching your data? do you need to fire off more macros do do some other work?

i'm asking all these questions because it is my way of learning...i'm a technical user, not a programmer
 
I haven't tried the input box yet. I won't be back to work until next week. Check the files folder on my site. Gives you an idea of how many macro's I use and just a couple of the many screens. I use 4 Sessions and each has 5-40 different screens. There are more screens I don't use but other people do. Shows a few toolbars, I have many more toolbars. I don't type anything I don't have to. I try to be just a button pusher. Other tasks require other toolbars for other macros. I use macros to take me to every screen I use and every task I need to do which are considerable. I use macros to take me to any of my favorites on the internet or open any file I need to use or any program I need to run. All information is confidential so I can't really show you anything. But If I leave they are going to have to hire 2 or 3 people to do what I do because nobody can do everything I do on my job without the macros. There is only 2 people in the office that are just beginning to do a few macros. VBA, different story.
 
 http://link99usn.spaces.live.com/
you're too much...your toolbars are amazing! my kinda technical user
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top