Wednesday, December 10, 2025

How to copy and paste in notepad excel with Arrow VBA

 Sub CommandButton1_Click()


    Shell "Notepad.exe", vbNormalFocus


    Dim I As Integer


    SendKeys "one"


    SendKeys "{Enter}"

     Application.Wait (Now + TimeValue("00:00:01"))

    SendKeys "^a"

     Application.Wait (Now + TimeValue("00:00:01"))

     SendKeys "^c"

     Application.Wait (Now + TimeValue("00:00:01"))

    SendKeys "{right}"

 Application.Wait (Now + TimeValue("00:00:01"))

    SendKeys "two"

 Application.Wait (Now + TimeValue("00:00:01"))

End Sub





How to send up and down keys in Excel or VBA

 https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/sendkeys-statement

How to open notepad with for loop and enter a to z characters in excel automatically

 Sub SendAlphabet_AtoZ()


Shell "Notepad.exe", vbNormalFocus

    Dim i As Integer

    Dim char_code As Integer

    Dim current_char As String

    Dim row_num As Integer

    

    

     Dim z As Integer


For z = 1 To 50

    row_num = 1

    ' Loop through ASCII codes for lowercase 'a' (97) to 'z' (122)

    For char_code = 50 To 122

        ' Convert the ASCII code to a character

        current_char = Chr(char_code)

        Application.Wait (Now + TimeValue("00:00:00"))

        ' Place the character in the active worksheet in column A

         SendKeys current_char

        

        ' Move to the next row

        

    Next char_code


Next z

  

End Sub

How to send Ctrl + F4 key in Powershell

 Start-Sleep -Seconds 5


$wshell = New-Object -ComObject WScript.Shell

$wshell.SendKeys("^{F4}")

How to count status in selected sheet open or close

 =Countif('SheetName'!I3:I998, "Open")


I3:I998 is range