Vapaa kuvaus

Isaan Rules WFF CCC If you walked away smiling-then for you the price was right Keep Exceling Suosikkibändit/artistit: Queen, Rammstein, genesis, Bruce Bringsteen, Kino, Mandref Mann Earth band Who Lempikirjat: ohjelmointi... Suosikkipalstat Suomi24 Keskusteluissa: EXCEL, Kivitalot, EPS En pidä: pakkanen ja loskakelit Ruoka & juoma: loimulohi ja valkkari Linkit: http://www.kundepuu.com, Khorat Koulutus: --- Ammatti: Tiede/teknologia Työskentelen: freelancer Ase tai siviilipalvelus: yliluutnantti Siviilisääty: Varattu Lapset: --- Hakusanat: Thaimaa, korat, Excel, VBA, ACAD, CNC, Polyurea, EPS, MgO elementti

Aloituksia

7

Kommenttia

1374

  • Uusimmat aloitukset
  • Suosituimmat aloitukset
  • Uusimmat kommentit
  1. If unsaved workbooks are open when you use this method, Microsoft Excel displays a dialog box asking whether you want to save the changes. You can prevent this by saving all workbooks before using the Quit method or by setting the DisplayAlerts property to False. When this property is False, Microsoft Excel doesn’t display the dialog box when you quit with unsaved workbooks; it quits without saving them.

    If you set the Saved property for a workbook to True without saving the workbook to the disk, Microsoft Excel will quit without asking you to save the workbook.

    joten kyllä allaoleva pitäisi toimia (toimii ainakin mulla)

    Sub Sulje()
    Application.DisplayAlerts = False
    Application.Quit
    End Sub

    suljetaan kaikki muut työkirjat yksitellen tallentamatta niitä (tai jos tarttee tallentaa niin muuta Työkirja.Close False---> Työkirja.Close True)-paitsi yksi (1 pitää olla aina auki..) eli jätetään yksi sulkematta ja sitten suljetaan se lopuksi.
    Nyt ei ainakaan pitäisi herjoja tulla...


    Sub Sulje2()
    Dim Työkirja As Workbook
    Application.DisplayAlerts = False

    For Each Työkirja In Application.Workbooks
    If Työkirja.Name "suljevikana.xls" Then ' muuta tähän aukijäävän työkirjan nimi
    Työkirja.Close False
    End If
    Next

    Application.Quit
    End Sub

    ohjeen mukaisesti...
    kerrotaan Excelille , että ollaankin tallennettu työkirjat... ;-)

    Sub Sulje3()
    Dim Työkirja As Workbook
    For Each Työkirja In Application.Workbooks
       Työkirja.Saved=True
    Next

    Application.Quit
    End Sub

    ei nyt muuta tuu mieleen tällä erää... jospa noilla probleema korjautuisi

    Keep Excelliong
    @Kunde
  2. nyt ei väliä missä kohtaan sarakkeessa viikot on esim. tyyliin 31,32,31,33,32,31,31,31,32,32,32,34,35 jne.


    Dim EiTupla As New Collection
    Dim Taulukko As Worksheet
    Dim i As Integer
    Dim Löydetty As Range
    Dim Haku As Variant

    Sub LisääTaulukko()
    On Error Resume Next
    Application.DisplayAlerts = False
    Application.ScreenUpdating = False

    Worksheets("Sheet1").Activate
    Vika = Range("D65536").End(xlUp).Row
    For Each solu In Range("D1:D" & Vika)
    If Not IsEmpty(solu) Then
    EiTupla.Add solu.Value, CStr(solu.Value)
    End If
    Next solu
    For i = 1 To EiTupla.Count
    For Each Taulukko In Worksheets
    If Taulukko.Name = EiTupla(i) Then
    Taulukko.Delete
    End If
    Next Taulukko
    Sheets.Add.Name = EiTupla(i)
    ActiveSheet.Move After:=Sheets(Sheets.Count)
    Haku = EiTupla(i)
    Set Löydetty = EtsiJaSiirrä(Haku, Range("Sheet1!D1:D" & Vika)).EntireRow
    Union(Löydetty, Löydetty).Copy Range(Haku & "!A65536").End(xlUp).Offset(1, 0).EntireRow

    Next
    Application.CutCopyMode = False
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    End Sub

    Function EtsiJaSiirrä(Hakuehto As Variant, HakuAlue As Range) As Range
    Dim solu As Range
    Dim EkaOsoite As String
    Worksheets("Sheet1").Activate
    With HakuAlue
    Set solu = .Find( _
    What:=Hakuehto, _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False, _
    SearchFormat:=False)
    If Not solu Is Nothing Then
    Set EtsiJaSiirrä = solu
    EkaOsoite = solu.Address
    Do
    Set EtsiJaSiirrä = Union(EtsiJaSiirrä, solu)
    Set solu = .FindNext(solu)
    Loop While Not solu Is Nothing And solu.Address EkaOsoite
    End If
    End With
    End Function
  3. moduuliin...
    etsii nyt sheet1:stä arvoa 11 ja siirtää löydetyt rivit sheet2:lle ekalle tyhjälle riville A- sarakkeessa
    muuttele vakioita tarpeesi mukaan...
    LookIn:=xlValues-xlFormulas
    LookAt:=xlWhole-xlPart
    MatchCase:=False-True

    Function EtsiJaSiirrä(Hakuehto As Variant) As Range
    Dim solu As Range
    Dim EkaOsoite As String
    Worksheets("Sheet1").Activate
    With Cells
    Set solu = .Find( _
    What:=Hakuehto, _
    LookIn:=xlValues, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False, _
    SearchFormat:=False)
    If Not solu Is Nothing Then
    Set EtsiJaSiirrä = solu
    EkaOsoite = solu.Address
    Do
    Set EtsiJaSiirrä = Union(EtsiJaSiirrä, solu)
    Set solu = .FindNext(solu)
    Loop While Not solu Is Nothing And solu.Address EkaOsoite
    End If
    End With

    End Function

    Sub Testi()
    Dim Löydetty As Range
    On Error GoTo virhe
    Set Löydetty = EtsiJaSiirrä(11).EntireRow
    Union(Löydetty, Löydetty).Copy Range("Sheet2!A65536").End(xlUp).Offset(1, 0).EntireRow
    Exit Sub
    virhe:
    MsgBox "hakuehdoilla ei löytynyt tietoja!", vbInformation
    End Sub