


Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!



Sub Paste_OneRow() 'Copy and Paste Row Sheets("sheet1").Range("1:1").Copy Sheets("sheet2").Range("1:1") Application.CutCopyMode = False End Sub
Sub Send_Mail() Dim OutApp As Object Dim OutMail As Object Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) With OutMail .to = "[email protected]" .Subject = "Test Email" .Body = "Message Body" .Attachments.Add ActiveWorkbook.FullName .Display End With Set OutMail = Nothing Set OutApp = Nothing End Sub
Sub ListSheets() Dim ws As Worksheet Dim x As Integer x = 1 ActiveSheet.Range("A:A").Clear For Each ws In Worksheets
ActiveSheet.Cells(x, 1) = ws.Name x = x + 1 Next ws End Sub Unhide All Worksheets
' Unhide All Worksheets Sub UnhideAllWoksheets() Dim ws As Worksheet For Each ws In ActiveWorkbook.Worksheets ws.Visible = xlSheetVisible Next ws End Sub Hide All Worksheets Except Active
' Hide All Sheets Except Active Sheet Sub HideAllExceptActiveSheet() Dim ws As Worksheet For Each ws In ThisWorkbook.Worksheets If ws.Name <> ActiveSheet.Name Then ws.Visible = xlSheetHidden Next ws End Sub Unprotect All Worksheets
' UnProtect All Worksheets Sub UnProtectAllSheets() Dim ws As Worksheet For Each ws In Worksheets ws.Unprotect "password" Next ws End Sub Protect All Worksheets
' Protect All Worksheets Sub ProtectAllSheets()
Next cell End Sub Highlight Negative Numbers
' Highlight Negative Numbers Sub HighlightNegativeNumbers() Dim myRange As Range Dim cell As Range Set myRange = Selection For Each cell In myRange If cell.Value < 0 Then cell.Interior.ColorIndex = 36 End If Next cell End Sub Highlight Alternate Rows
' Highlight Alternate Rows Sub highlightAlternateRows() Dim cell As Range Dim myRange As Range myRange = Selection For Each cell In myRange.Rows If Not Application.CheckSpelling(Word:=cell.Text) Then cell.Interior.ColorIndex = 36 End If Next cell End Sub Highlight Blank Cells in Selection
' Highlight all Blank Cells in Selection Sub HighlightBlankCells() Dim rng As Range Set rng = Selection rng.SpecialCells(xlCellTypeBlanks).Interior.Color = vbCyan End Sub