; Macro: Compresses empty data cells in a range of columns ; ; Clear all Memory Registers CM ; ; Input Dialog Box: alpha "Initial Column to be Compressed" STOa 0 alpha "Last Column to be Compressed" STOa 1 alpha "Compress Macro" inpt 2 ; ; Storage Locations ; 00 - First column getting compressed ; 01 - Last column getting compressed ; 02 - Number of rows in the data window ; 03 - Column Counter ; 04 - Row Counter ; 06 - Row and Column # in decimal form (ex. 9.003 is row 9, col 3) ; 07 - Temporary storage of cell address ; ibase size ; Returns the size of the data window STO 02 ; Store the number of rows in data window RCL 00 ; Recall column number STO 03 ; Set Column Counter GTO 40 ; Store address in decimal form, set row counter GTO 20 ; Start reading data in the first column ; LBL 10 RCL 01 ; Recall final column value ISG 03 ; Increment counter by 1, are contents of 03 <= 01 GTO 40 ; Yes - Increase column STOP ; No - Stop program ; LBL 20 RCLi 06 ; Recall data from cell specified in mem. reg. 06 test 1 ; Test for empty data cell GTO 70 ; Search for next cell with data ; LBL 25 0e+00 DSE 04 ; Decrement counter by 1; Are contents of 02 > 0.0 GTO 30 ; Yes - Increase row number by 1 GTO 10 ; Go to next column ; LBL 30 XEQ 60 GTO 20 ; LBL 40 RCL 03 ; Recall current column 1000 / ; Divide column by 1000 STO 06 ; Store column in decimal format STO 07 RCL 02 STO 04 ; Reset Row Counter GTO 20 ; LBL 60 RCL 06 ; Recall current address 1 ADD 06 ; Increase address by 1 RTN ; LBL 62 RCL 06 ; Recall current address 1 + STO 07; Set temp address to current address + 1 GTO 85 ; LBL 64 RCL 07 ; Recall address 1 ADD 07 ; Increase address by 1 GTO 85 ; LBL 70 RCL 07 ; Recall current address GTO 90 ; Test for next cell with data ; LBL 75 RCLi 07 ; Get data from that cell STOi 06 ; Store the data in the original empty cell CLRi 07 ; Clear the contents of the second cell GTO 25 ; LBL 80 ; Look for next cell with data RCL 07 ; Recall temporary address RCL 06; Recall current address x > y; Test if current address is greater than temporary address GTO 62 ; Yes - Set temp address to current address +1 GTO 64; No - increase temp address by 1 ; LBL 85 RCLi 07 ; Recall data test 1 ; Test for an empty cell GTO 90 GTO 75 ; LBL 90 RCL 02 ; Recall the original # of rows 1 - RCL 07 ; Recall the current address int ; Get the integer portion of the address x = y ; Check to see if current address = # of rows GTO 10 ; Yes - move to next column GTO 80 ; No - go to next data cell ; ; Version 1.2 - August 22, 2006 ; by Steve Wilson