Jump to content
Hlaurent

Excel - Filling cells from radio button groups on autoit form - help me please

Recommended Posts

Hlaurent

hi. i tried so much and at the end here i am writing this:

my problem is that i cant find a way to assign "WRITE'EM" button to send radio group values (as text or number) to a specific cell (column(x) and already selected row(selected y)) in already opened (active excel document) .

process:

WHO button :  Entries to the excel table will be one after another. So i will select the first cell manually. then i start gui and  I will press WHO. (i made it already and it works. so help that i need is not here) 

SHEET, DAYS, STARTS, WEEKEND selections will be clicked by user (me) and WRITE'EM button should send all radio-button values at once to the cells (selected row number(y) which i chose as i activate WHO button.

for example : SHEET VALUE = 43 should fill "43" cell(6,$y)
and $y is active cell row number. 

DAYS Value = 30 should fill "30" cell(7,$y)
STARTS value = "15.06.2015" cell(8,$y)
WEEKEND value ="YOK" cell(9,$y)
 

as i hit the WRITE'EM

tumblr_nop61lhUdT1rt0f83o1_500.jpg

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#Region ### START Koda GUI section ### Form=C:\Users\hloo\Documents\koda_1.7.3.0\Forms\staj_go.kxf
Global $Form1 = GUICreate("Form1", 398, 287, 445, 275)
Global $Edit1 = GUICtrlCreateEdit("", 48, 24, 329, 73)
GUICtrlSetData(-1, "Edit1")
Global $Button1 = GUICtrlCreateButton("WRITE'EM", 96, 216, 105, 33) ; sends all radio button group values to specific cells at once
Global $Button3 = GUICtrlCreateButton("WHO", 8, 24, 33, 225)
Global $Group1 = GUICtrlCreateGroup("SHEET", 48, 112, 57, 81)
Global $Radio1 = GUICtrlCreateRadio("22", 56, 136, 49, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
Global $Radio2 = GUICtrlCreateRadio("43", 56, 160, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group2 = GUICtrlCreateGroup("DAYS", 112, 112, 65, 81)
Global $Radio3 = GUICtrlCreateRadio("30", 128, 136, 33, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
Global $Radio4 = GUICtrlCreateRadio("60", 128, 160, 41, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group3 = GUICtrlCreateGroup("STARTS", 184, 112, 105, 81)
Global $Radio5 = GUICtrlCreateRadio("15.06.2015", 200, 136, 81, 17)
Global $Radio6 = GUICtrlCreateRadio("29.06.2015", 200, 160, 81, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group4 = GUICtrlCreateGroup("WEEKEND", 296, 112, 81, 81)
Global $Radio7 = GUICtrlCreateRadio("VAR", 312, 136, 49, 17)
Global $Radio8 = GUICtrlCreateRadio("YOK", 312, 160, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

         Case $Button3
Local $i = 0
; take information from active excel, select 2 cell and send it to autoit form by simple keyboard keys - done
Do
   WinActivate("Microsoft Excel") ; go to Excel
                WinWaitActive("Microsoft Excel")
                Sleep(500)
                Send("+{RIGHT 2}")
                Sleep(500)
                Send("^c")
                Send("!{TAB}") ; back
                Sleep(500)
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("^a")
                Send("^v")
Until GUICtrlRead($Button3) = $i
 ; copies 


;Case $Radio1 ------------------below, that i couldnt manege to make it right
;   if $Radio1 = 1 then
;     Local $belge = "22"
;   ElseIf $Radio2 = 1 then
;     Local $belge = "43"
;   Case $Radio3
;     if $Radio3 = 1 then
;     Local $gun = "30"
;   ElseIf $Radio2 = 1 then
;     Local $gun = "60"


;Case $Button1
;.cells($i, $j).value = $belge ----------------- this part that i need help most.
           EndSwitch

WEnd

i put ";" marks to my failures. if you want to help this code-poor person which is happen to be me, please don't bother to write all. just a clue would be enough.

ps: i don't need MSGBOX in any section of this. But all i find as function in examples is msgbox. 
i dont need clean excel book to open. i have students information in existed excel file and all i need to automate some specific cells again and again.

thx thx thx.

 

sry i forgot  here is the piece of excel file that i work on.

https://docs.google.com/spreadsheets/d/1Gins_bYw143qn_voZQBsCAwPMQDbwDyttg1l_qKZ5HU/edit?usp=sharing

 

Edited by Hlaurent

Share this post


Link to post
Share on other sites
MikahS

Have a look at the Excel UDF.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Hlaurent

. with quote, answer is below 

Edited by Hlaurent
didn't see the quote thing at first

Share this post


Link to post
Share on other sites
Hlaurent

Have a look at the Excel UDF.

i looked there. thx for quick response btw. But that is not the answer to my deadlock.

i need an example which uses _Excel_RangeWrite whom range is consist of already selected row number and constant x for radio groups.

 

Share this post


Link to post
Share on other sites
MikahS

It looks like your trying to use dot notation on an object without a MS excel object.


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
l3ill

Hi,

 as MikahS Mentioned you will eventually have to get cosy with the excel UDF.

But in the mean time I threw together a down and dirty example that I think might answer your question of how to get your GUI variables; radio buttons etc into an excel sheet.

This is mostly CCP' ed from the helpfile with some small changes to illustrate the point.

#include <GUIConstantsEx.au3>
#include <Excel.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example")
    Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25)
    Local $idSend = GUICtrlCreateButton("Send", 200, 200, 85, 25)
    Global $Radio1 = GUICtrlCreateRadio("22", 56, 136, 49, 17)
    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idOK
                ExitLoop
            Case $idSend ;---------------Send Button Calls Case $iDSend----------Case calls Function named ""SendToExcel()"" below
                SendToExcel()

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example



Func SendToExcel()

    ; Create application object and create a new workbook
    Local $oAppl = _Excel_Open()
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookNew($oAppl)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_Close($oAppl)
        Exit
    EndIf

    ;--------------------------------------------------
    $radioVar = GUICtrlRead($Radio1)

    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $radioVar, "A3")

    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

EndFunc
Edited by l3ill
effed up

Share this post


Link to post
Share on other sites
Hlaurent

Hi,

 as MikahS Mentioned you will eventually have to get cosy with the excel UDF.

But in the mean time I threw together a down and dirty example that I think might answer your question of how to get your GUI variables; radio buttons etc into an excel sheet.

This is mostly CCP' ed from the helpfile with some small changes to illustrate the point.

 what a active forum! thank you firstly. 

in your example you decided the source cell right? = A3.  

$radioVar = GUICtrlRead($Radio1)

    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $radioVar, "A3")

but i need something like this: 

i click -for randomly example- D36 cell on already open excel doc.

can i have this :

$activeCellRow = _excelGetActiveRowValue() ; which i made up - which is my question
$constantColomn1 = 6
(then your way)

$radioVar = GUICtrlRead($Radio1)

    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $radioVar, "$oExcel.activesheet.Cells( $constantColomn1, $activeCellRow)") <<<----instead of "A3"

ok?

i need variables comes from active-manually-clicked cell's row information instead of determinative "A3" or any thing like that. 

so i need to automate the cell ingredients. x and y from outside of user entry. 

 

Edited by Hlaurent
"column is first" fix

Share this post


Link to post
Share on other sites
MikahS

Quick example of how to get the active cell using dot notation. Don't know if it's a very elegant solution, but it gives you an idea of what to search for etc.

#include <Excel.au3>

HotKeySet("{ESC}", "Quit")

Local $oWorkbook = _Excel_Open()

_Excel_BookNew($oWorkbook)
_Excel_SheetAdd($oWorkbook)

Local $oRange = $oWorkbook.Application.Activecell.Address

Local $oAddress = StringReplace($oRange, "$", "")

MsgBox(0, "", $oAddress)

while 1

WEnd

Func Quit()
    _Excel_Close($oWorkbook)
    Exit
EndFunc

 


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
l3ill

Sorry, I am not positive what you are going for but as mentioned before you will have to get in to the help file and play around with the examples and find the function closes to what you want to achieve and then change it accordingly.

That's how I learned :D the little bit I know...

Specifically I would start with _Excel_RangeRead

The keywords you mentioned seem to be going this direction.

BTW: There are other ways of directing data into the sheet besides A1 Range; array, 2D array, Range Object...

Edited by l3ill
msp

Share this post


Link to post
Share on other sites
l3ill

Very Cool MikahS !

So using this additional code I have updated my example.

Now you can click on your excel sheet where you want to insert and then click the send button on the GUI...

 

#include <GUIConstantsEx.au3>
#include <Excel.au3>

Example()

Func Example()
    ; Create a GUI with various controls.
    Local $hGUI = GUICreate("Example")
    Local $idOK = GUICtrlCreateButton("OK", 310, 370, 85, 25)
    Local $idSend = GUICtrlCreateButton("Send", 200, 200, 85, 25)
    Global $Radio1 = GUICtrlCreateRadio("22", 56, 136, 49, 17)
    ; Display the GUI.
    GUISetState(@SW_SHOW, $hGUI)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $idOK
                ExitLoop
            Case $idSend ;---------------------------------Send Button Calls Case $iDSend----------Case calls Function named ""SendToExcel()"" below
                SendToExcel()

        EndSwitch
    WEnd

    ; Delete the previous GUI and all controls.
    GUIDelete($hGUI)
EndFunc   ;==>Example



Func SendToExcel()

    $radioVar = GUICtrlRead($Radio1)
    Local $sWorkbook = @ScriptDir & "\_Excel1.xls"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
     Local $oRange = $oWorkbook.Application.Activecell.Address
     Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $radioVar, $oAddress)

    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example 2", "Error writing to worksheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended)


EndFunc   ;==>SendToExcel

 

 

 

Edited by l3ill
additional info
  • Like 1

Share this post


Link to post
Share on other sites
Hlaurent

Quick example of how to get the active cell using dot notation. Don't know if it's a very elegant solution, but it gives you an idea of what to search for etc.

Very Cool MikahS !

So using this additional code I have updated my example.

Now you can click on your excel sheet where you want to insert and then click the send button on the GUI...

 thank you both  MikahS and  I3ill very much.  i couldn't finish it today though, i feel that i m almost there with your help. 

I3ill 

your example send always "1" to the cell. but it s cool. now i know $oWorkbook.Application.Activecell.Address thing which is pretty good clue for me.  

my all au3s in my workplace. and i forgot to copy them for home. till monday,,, have a nice weekend to you.

thx again. 

Share this post


Link to post
Share on other sites
MikahS

@Hlaurent My pleasure. Let us know how it goes. 


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites
Hlaurent

done. 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <MsgBoxConstants.au3>
#include <Excel.au3>
#Region ### START Koda GUI section ### Form=C:\Users\hloo\Documents\koda_1.7.3.0\Forms\staj_go.kxf

Example()

Func Example()
Global $Form1 = GUICreate("Form1", 398, 287, 445, 275)
Global $Edit1 = GUICtrlCreateEdit("", 48, 24, 329, 73)
GUICtrlSetData(-1, "Edit1")
Global $Button1 = GUICtrlCreateButton("YAZ", 96, 216, 105, 33)
Global $Button2 = GUICtrlCreateButton("NEXT", 224, 216, 57, 33)
Global $Button3 = GUICtrlCreateButton("BILGI", 8, 24, 33, 225)
Global $Group1 = GUICtrlCreateGroup("BELGE", 48, 112, 57, 81)
Global $Radio1 = GUICtrlCreateRadio("22", 56, 136, 49, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
Global $Radio2 = GUICtrlCreateRadio("43", 56, 160, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group2 = GUICtrlCreateGroup("SÜRE", 112, 112, 65, 81)
Global $Radio3 = GUICtrlCreateRadio("30", 128, 136, 33, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
Global $Radio4 = GUICtrlCreateRadio("60", 128, 160, 41, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group3 = GUICtrlCreateGroup("BASLAMA", 184, 112, 105, 81)
Global $Radio5 = GUICtrlCreateRadio("15.06.2015", 200, 136, 81, 17)
Global $Radio6 = GUICtrlCreateRadio("29.06.2015", 200, 160, 81, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Group4 = GUICtrlCreateGroup("CUMARTESI", 296, 112, 81, 81)
Global $Radio7 = GUICtrlCreateRadio("VAR", 312, 136, 49, 17)
Global $Radio8 = GUICtrlCreateRadio("YOK", 312, 160, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
            Case $Button3
   WinActivate("Microsoft Excel") ; go to Excel
                WinWaitActive("Microsoft Excel")
                Sleep(300)
                Send("+{RIGHT 2}")
                Sleep(300)
                Send("^c")
                Send("{RIGHT}")
                Send("{RIGHT}")
                Send("{RIGHT}")
                Send("!{TAB}") ; back
                Sleep(300)
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("^a")
                Send("^v")

          Case $Button1 ;------Send Button Calls Case $iDSend------Case calls Function named ""SendToExcel()"" below
             SendToExcel()
          Case $Button2
             WinActivate("Microsoft Excel") ; -------------------if it s wrong next
                WinWaitActive("Microsoft Excel")
                Sleep(300)
                Send("^h"); triggers excel macro to paint the cell red
                Send("{DOWN}")
                Send("{LEFT}")
                Send("{LEFT}")
                Send("{LEFT}")
                Sleep(300)
                Send("+{RIGHT 2}")
                Sleep(300)
                Send("^c")
                Send("{RIGHT}")
                Send("{RIGHT}")
                Send("{RIGHT}")
                Send("!{TAB}") ; back
                Sleep(300)
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("{TAB}")
                Send("^a")
                Send("^v") ; back
             EndSwitch
WEnd

 EndFunc



   Func SendToExcel()
    if GUICtrlRead($Radio1) = "1" Then ; ------------------------------------------------first part
Local $setradio1 = "22"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio1, $oRange)

ElseIf GUICtrlRead($Radio2) = "1" Then
    Local $setradio2 = "43"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio2, $oRange)
 EndIf
 WinActivate("Microsoft Excel") ; go to Excel
                WinWaitActive("Microsoft Excel")
                Sleep(300)
                Send("{RIGHT}")
                if GUICtrlRead($Radio3) = "1" Then ;----------------------------------------second part
Local $setradio3 = "30"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio3, $oRange)

ElseIf GUICtrlRead($Radio4) = "1" Then
    Local $setradio4 = "60"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio4, $oRange)
 EndIf
 WinActivate("Microsoft Excel") ; go to Excel
                WinWaitActive("Microsoft Excel")
                Sleep(300)
                Send("{RIGHT}")
                Send("{RIGHT}")
                Send("{RIGHT}");-----------------------------------------------------3th part
                if GUICtrlRead($Radio5) = "1" Then
                Local $setradio5 = "15.06.2015"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio5, $oRange)

ElseIf GUICtrlRead($Radio6) = "1" Then
    Local $setradio6 = "29.06.2015"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio6, $oRange)
 EndIf

 WinActivate("Microsoft Excel") ; go to Excel
                WinWaitActive("Microsoft Excel")
                Sleep(300)
                Send("{LEFT}");-----------------------------------------------------4th part
                if GUICtrlRead($Radio7) = "1" Then
                Local $setradio7 = "VAR"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio7, $oRange)

ElseIf GUICtrlRead($Radio8) = "1" Then
    Local $setradio8 = "YOK"
    Local $sWorkbook = "C:\Users\hloo\Desktop\stajlar 2015 taslak\New folder\48.xlsx"
    Local $oWorkbook = _Excel_BookAttach($sWorkbook)
    Local $oRange = $oWorkbook.Application.Activecell.Address
    Local $oAddress = StringReplace($oRange, "$", "")
    _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $setradio8, $oRange)
 EndIf
 WinActivate("Microsoft Excel") ;
                WinWaitActive("Microsoft Excel")
                Sleep(300)
                Send("{DOWN}")
                Send("{LEFT 6}")
                Sleep(100)
                Send("!{TAB}")
EndFunc

 

even if this s very very bad coding -i know i admit- now it's functioning very well for me. 

thx again, your contribution helped me a lot. 

Share this post


Link to post
Share on other sites
MikahS

No problem, glad you found a solution. ^_^


Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4

Feel free to use any of my code for your own use.                                                                                                                                                           Forum FAQ

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • Skeletor
      By Skeletor
      Hi Guys,
      Can anyone point me in the right direction. I'm trying to accomplished conditional formatting with arrows, but the code I have is wrong... 
      .Range("=$A3:$A4000").FormatConditions.Add = (xlCellValue, xlGreater, "=$A:$A") .IconSet(xl3Arrows) ;ActiveWorkbook.iconsets I also tried it like this:
      .Range("=$A3:$A4000").FormatConditions _ .Add(xlCellValue, xlGreater, "=$A:$A") .IconSet(xl3Arrows) ;ActiveWorkbook.iconsets  
    • Skeletor
      By Skeletor
      Hi Guys,
      How would you use _Excel_FilterSet to filter the excel sheet from largest number to smallest number?
      _Excel_FilterSet($oWorkbook, "Sheet1", "A2:I2", 1, ">20", 1, "<40") ; OR _Excel_FilterSet($oWorkbook, "Sheet1", "A2:I2", 1, ">", 1, "<") Excel Sheet attached. Trying to filter on the last column "I2"
      Inventory.xlsx
    • Skeletor
      By Skeletor
      Hi All,
      Has anyone come across this before?
      Code below:
      $SheetList = _Excel_SheetList($oWorkbook) _FileWriteFromArray("C:\" & $SheetListOutput, $SheetList, 1) Result:
      ResultABC| ResultDEF| ResultGHI| ResultJKL| ResultMNO| It created these "|" vertical bars?
    • Skeletor
      By Skeletor
      Hi All,

      I would like to know how you would take a FileLineRead and insert it into an array which then inserts it into Excel?
      One thing to know is the files content is broken up, so I only use half of the content within $FileRead1.
      So its imperative that the $value1, $value2, etc variables be used. 
      Code below:
      $FileRead1 = FileReadLine("C:\temp\sample.txt",1) For $count = 1 To _FileCountLines($FileRead1) Step 1 $string = FileReadLine($FileRead1, $count) $input = StringSplit($string, ",", 1) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] $value4 = $input[4] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value1, "A1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value2, "B1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value3, "C1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value4, "D1") Next  
    • AnonymousX
      By AnonymousX
      Hello,
      I'm trying to write a script that moves copies excel cells into an array. I'll than manipulate the values and send array into another program. 
      I don't want range to be specific to a workbook, or sheet, or set of cells.
      I want user to be able to highlight desired cells and to copy either normally ("Ctrl+C") or by a hotkey ("Alt+C"). 
      Could someone help me with this?
      Thank you,
      I've tried to write the framework: (edited)
      #include <MsgBoxConstants.au3> #include <Array.au3> #include <Excel.au3> HotKeySet("!v", "Pastedata") While True Sleep(1000) WEnd func Makearray() local $bArray ;User has cells already copied ;Convert clipboard into an array ;I don;t know how excel stores data to clipboard so don;t know how to bring it into array _Arraydisplay($bArray) MsgBox(0,0,$bArray) return $bArray endfunc func Pastedata() Local $aArray MsgBox(0,0,"wait",1) ;make array based on assumption user has already copied a range to clipboard $aArray = Makearray() ;paste code ;don;t worry about this I got the rest endfunc  
×