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
 Origin Forum
 using script to add an equation to ws cell

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
zknauss Posted - 07/13/2022 : 4:42:00 PM
Using command script I'd like to get the equation below inserted in cell A1 and then have it copied across all columns in row A so that the data sources automatically update (as they would if you manually pulled the equation across. I've tried doing this numerous ways but can't seem to get the equation to be entered into the cell. Thanks!

=Slope([NCONT1PeakDa1]"Center Grvty"!1,[NCONT1PeakDa1]"Peak Index"!1)



ZTK
5   L A T E S T    R E P L I E S    (Newest First)
zknauss Posted - 07/14/2022 : 12:06:42 PM
That worked perfectly just had to add a space after the i++ Thanks so much!

ZTK
YimingChen Posted - 07/14/2022 : 11:40:30 AM
You can just do a for loop:

for (int i = 0; i <= wks.ncols; i++) {
	wcol(i) = movslope([NCONT1PeakDa1]"Center Grvty"!$(i),[NCONT1PeakDa1]"Peak Index"!$(i));
}


James
zknauss Posted - 07/14/2022 : 11:19:11 AM
This is the excel macro version of what I'd like to do.

Range("A1:B1").Select
Selection.AutoFill Destination:=Range("A1:end"), Type:=xlFillDefault

Where Columns 1 and 2 already have the function in row 1 and then that function is copied through the end of the document.

ZTK
zknauss Posted - 07/14/2022 : 10:43:46 AM
It's not so much the equation that is the problem but how to get the equation to pull data correctly for each column I figured out the first part to put the equation in Col:(A) row:(1) below. Now I just need it applied to each column in the spreadsheet so columns A:end. I've also written out what the next column would be if I wrote out the full equation for each column entry

Col(A)=Movslope([NCONT1PeakDat]"Center Grvty"!1,[NCONT1PeakDat]"Peak Index"!1);

Col(B)=Movslope([NCONT1PeakDat]"Center Grvty"!2,[NCONT1PeakDat]"Peak Index"!2);
YimingChen Posted - 07/14/2022 : 09:10:37 AM
Hi,

Can you try replacing the column index by column short name?

=Slope([NCONT1PeakDa1]"Center Grvty"!A,[NCONT1PeakDa1]"Peak Index"!A)

See if this works.

James

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