The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Activate sheet by range

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
AKazak Posted - 07/15/2022 : 01:44:57 AM
OriginPro 2022b (64-bit) SR1 9.9.5.171
Windows 7 Pro SP1 x64

Greetings!

I have a range object with few columns on a specified sheet.
How do I activate the sheet from the range object?
How do I select the range?

Thank you.

---
Andrey
6   L A T E S T    R E P L I E S    (Newest First)
AKazak Posted - 07/18/2022 : 12:25:04 AM
quote:
Originally posted by YimingChen

Pass the column index from colStart to colEnd into the wks.colSel() function.



Got it!
Thanks.

---
Andrey
YimingChen Posted - 07/15/2022 : 12:22:50 PM
Pass the column index from colStart to colEnd into the wks.colSel() function.
AKazak Posted - 07/15/2022 : 11:28:36 AM
quote:
Originally posted by YimingChen

For example, if you have multiple columns in a range. You need to get the start and end columns, you may use:

range rd = [Book2]Sheet3!5:10;
String strRange = %(rd);
int colStart = value(between(strRange$,"!",":")$);
int colEnd = value(GetToken(strRange$,2,":")$);
colStart=;
colEnd=;


James



I see.
Where do I pass colStart and colEnd values?

---
Andrey
YimingChen Posted - 07/15/2022 : 11:25:21 AM
For example, if you have multiple columns in a range. You need to get the start and end columns, you may use:

range rd = [Book2]Sheet3!5:10;
String strRange = %(rd);
int colStart = value(between(strRange$,"!",":")$);
int colEnd = value(GetToken(strRange$,2,":")$);
colStart=;
colEnd=;


James
AKazak Posted - 07/15/2022 : 10:55:47 AM
quote:
Originally posted by YimingChen

If you have one column in the range, you can try the sample script below:

range r1 = [book1]1!1;
win -a %(r1.GetPage()$); // activate the page
range rwks = r1.GetLayer()$;
page.active$ = rwks.name$; // activate the sheet
wks.colSel(Colnum(r1), 1); // select the column


If you have multiple columns, you may need to parse the range string to get the columns. The range string can be obtained by:

String strRange = %(r1);


James



Dear James,

Got it.

What do you mean by parsing the range string to get the columns?

---
Andrey
YimingChen Posted - 07/15/2022 : 10:01:51 AM
If you have one column in the range, you can try the sample script below:

range r1 = [book1]1!1;
win -a %(r1.GetPage()$); // activate the page
range rwks = r1.GetLayer()$;
page.active$ = rwks.name$; // activate the sheet
wks.colSel(Colnum(r1), 1); // select the column


If you have multiple columns, you may need to parse the range string to get the columns. The range string can be obtained by:

String strRange = %(r1);


James

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000