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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Adress worksheets by numbers possible?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clemens604

Germany
3 Posts

Posted - 05/25/2022 :  04:47:23 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,

I'm completely new to LabTalk therefore please excuse me, if my question is stupid.

I am using the following "before formula script" (in "set values" for a column):

range FCval = [Book1]#1.39_0__14-47-19-730!col(D)

By this I define the range variable FCval as the column D in the worksheet with the name #1.39_0__14-47-19-730.

So far so good, it works as long as the name of the worksheet stays the same. However, I want to use worksheets with many range variables as shown above as templates for other file,s where the worksheets have differing names. Now I have to change all the worksheet names manually which is quite annoying.

Therefore my question is, if I can address the worksheets e.g by their ordering number as I can do it e.g. in VBA for Excel ("sheets(1)")? Or is there another solution?

Thank you in advance and best regards,
Clemens




Origin Ver. and Service Release Origin 2022 (64-bit) SR1
Operating System: Win10

Clemens604

Germany
3 Posts

Posted - 05/25/2022 :  06:07:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Ok, I've already found the solution. I could just replace the name of the worksheet by its' index. E.g.:

range FCval = [Book1]#1.39_0__14-47-19-730!col(D)
range FCval = [Book1]3!col(D)

What didn't work was:

range FCval = [Book1]Sheet3!col(D)

Just in case someone has the same problem...
Go to Top of Page

aplotnikov

Germany
173 Posts

Posted - 05/25/2022 :  07:04:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
range FCval = [Book1]"Sheet3"!col(D)
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 05/25/2022 :  11:07:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You should just stick with 3!, Sheet3 means the sheet name is "Sheet3" which is not your case.

As long as you just rename and not moving the sheet around, that should work.

CP
Go to Top of Page

Clemens604

Germany
3 Posts

Posted - 05/30/2022 :  07:54:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Yepp, just "3" works perfectly. Thanks!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000