Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
lutsen
Femeie
24 ani
Cluj
cauta Barbat
24 - 48 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Change Text in Document with UserForm [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
TRaP
Moderator

Inregistrat: acum 6 ani
Postari: 748
Similar to this but in Excel:

In Excel it is simpler because you don't need to create bookmarks and set them as ranges, in Excel you already have cells as ranges.

This part goes in the code of ThisWorkbook:


Private Sub Workbook_Open()
    SelectCompany.Show
End Sub


This code goes in the code of the SelectCompany UserForm:


Private Sub OKButton_Click()
Dim Company1Rng As Range
Dim Company2Rng As Range
   
Set Company1Rng = Range("B2")
Set Company2Rng = Range("B65")

If CMP1 Then
    Company1Rng.Value = "COMPANY 1"
    Company2Rng.Value = "COMPANY 1"
    Unload SelectCompany
    Exit Sub
    Else
   
    If CMP2 Then
        Company1Rng.Value = "COMPANY 2"
        Company2Rng.Value = "COMPANY 2"
        Unload SelectCompany
        Exit Sub
        Else
       
        If CMP3 Then
            Company1Rng.Value = "COMPANY 3"
            Company2Rng.Value = "COMPANY 3"
            Unload SelectCompany
            Exit Sub
            Else
           
            If CMP4 Then
                Company1Rng.Value = "COMPANY 4"
                Company1Rng.Value = "COMPANY 4"
                Unload SelectCompany
                Exit Sub
            End If
        End If
    End If
End If
End Sub


pus acum 5 ani
   
Pagini: 1  

Mergi la