SorryButImaNewbie Posted October 4, 2016 Share Posted October 4, 2016 (edited) Hello everyone! I try to insert a column with _excel_rangeinsert. I loop over a specified row, with different strings, and I want to insert a colum after the "OSSZEG" string (the columletter for OSSZEG is stored in the $OSSZEGoszlop variable) And here I have little logical problem. I know that this string is in column, for example, C, but is there a way to tell the UDF to insert to $vRange. Like: _Excel_RangeInsert($ExcelObject.Activesheet, $OSSZEGoszlop &":"&"D") Here I would like my script to be clever enough to know that If $OSSZEGoszlop is C the it insert between C and D, if its D its insert between D and E. So My basic question: Is there a String++ thing in autoit I can use for this? (If $A = "A" , $A++ = "B" or something like this) Alternatively I can only think of writing a /Select Case/ for every letter and call me crazylazy but, I just don't think it is the best solution, also a that long case select would run like 2-4 seconds, which is kind of long for a column insert. (or It runs less then 0.5 sec and I'm just not very good at telling how long a script needs to be executed ) Thanks for the help! Edited October 4, 2016 by SorryButImaNewbie Link to comment Share on other sites More sharing options...
l3ill Posted October 4, 2016 Share Posted October 4, 2016 Hi, If we had your code it would save a lot of time. Please post a reproducer with your loop. Thanks, Bill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
AutoBert Posted October 4, 2016 Share Posted October 4, 2016 if you have sheets with max range A...Z then you can it do this way: $OSSZEGoszlop='C' $sRange=$OSSZEGoszlop&':'&Chr(Asc($OSSZEGoszlop)+1) MsgBox(64,'Range',$sRange) $sRange is what you are searching for. SorryButImaNewbie 1 Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted October 4, 2016 Author Share Posted October 4, 2016 Sure, also I dont really think it will help, the entire thing is getting a bit long, but here is the "relevant" part I think: expandcollapse popupLocal $OSSZEGoszlop = "" Select Case $AOszlop = "OSSZEG" $OSSZEGoszlop = "A" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $Boszlop = "OSSZEG" $OSSZEGoszlop = "B" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $COszlop = "OSSZEG" $OSSZEGoszlop = "C" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $DOszlop = "OSSZEG" $OSSZEGoszlop = "D" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $EOszlop = "OSSZEG" $OSSZEGoszlop = "E" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $FOszlop = "OSSZEG" $OSSZEGoszlop = "F" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $GOszlop = "OSSZEG" $OSSZEGoszlop = "G" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $HOszlop = "OSSZEG" $OSSZEGoszlop = "H" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $IOszlop = "OSSZEG" $OSSZEGoszlop = "I" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $JOszlop = "OSSZEG" $OSSZEGoszlop = "J" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $KOszlop = "OSSZEG" $OSSZEGoszlop = "K" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $LOszlop = "OSSZEG" $OSSZEGoszlop = "L" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $MOszlop = "OSSZEG" $OSSZEGoszlop = "M" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $NOszlop = "OSSZEG" $OSSZEGoszlop = "N" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $OOszlop = "OSSZEG" $OSSZEGoszlop = "O" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $POszlop = "OSSZEG" $OSSZEGoszlop = "P" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $QOszlop = "OSSZEG" $OSSZEGoszlop = "Q" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $ROszlop = "OSSZEG" $OSSZEGoszlop = "R" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $SOszlop = "OSSZEG" $OSSZEGoszlop = "S" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $TOszlop = "OSSZEG" $OSSZEGoszlop = "T" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $UOszlop = "OSSZEG" $OSSZEGoszlop = "U" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $VOszlop = "OSSZEG" $OSSZEGoszlop = "V" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $WOszlop = "OSSZEG" $OSSZEGoszlop = "W" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $XOszlop = "OSSZEG" $OSSZEGoszlop = "X" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $YOszlop = "OSSZEG" $OSSZEGoszlop = "Y" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") Case $ZOszlop = "OSSZEG" $OSSZEGoszlop = "Z" ;MsgBox($MB_SYSTEMMODAL, "Értesítés!", "A SZAMLATELJ : " & $SZAMLATELJoszlop & " oszlop!") EndSelect MsgBox($MB_SYSTEMMODAL, " Értesítés", "Az OSSZEG oszlop a: " & $OSSZEGoszlop & "") _Excel_RangeInsert($ExcelObject.Activesheet, $OSSZEGoszlop) MsgBox($MB_SYSTEMMODAL, " Értesítés", "Elvben beszúrtam") The $ExcelObject is the excel file I'm working on, The slect case loop throught a specified row (the title row which I searched for above the code, giving me the $Aoszlop and the rest as variable, these variabels point to their respective column + a $CellNumb. I read the title row, to find the string "OSSZEG", if I found it I would like the last row to insert a colum after the $OSSZEGoszlop, Thats why I would need the next letter in the alphabet (or possible AA or something, but I haven't seen any excel among these kind od documents, that used the AA, AB etc columns) Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted October 4, 2016 Author Share Posted October 4, 2016 15 minutes ago, AutoBert said: if you have sheets with max range A...Z then you can it do this way: $OSSZEGoszlop='C' $sRange=$OSSZEGoszlop&':'&Chr(Asc($OSSZEGoszlop)+1) MsgBox(64,'Range',$sRange) $sRange is what you are searching for. Thanks AutoBert! and Thanks for ASCII Thats what I was looking for, I can modify it to fit my needs perfectly Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now