PepeTheImpaler
New Member
- Joined
- Jun 13, 2018
- Messages
- 3
Hello,
I have this macro and I need help. " If Worksheets.Select = "Vykazy_data" Then End", this part dont work. Pls help with solution. I need to skip one worksheet in this loop
Private Sub CommandButton2_Click()
Dim i As Integer
Dim xTCount As Variant
Dim xWs As Worksheet
Application.DisplayAlerts = False
ActiveWorkbook.Worksheets("VÝSLEDEK").Delete
Application.DisplayAlerts = True
On Error Resume Next
LInput:
xTCount = Application.InputBox("počet řádků v hlavičce", "", "1")
If TypeName(xTCount) = "Boolean" Then Exit Sub
If Not IsNumeric(xTCount) Then
MsgBox "Napiš číslo"
GoTo LInput
End If
Set xWs = ActiveWorkbook.Worksheets.Add(Sheets(1))
xWs.Name = "VÝSLEDEK"
Worksheets(1).Range("A1").EntireRow.Copy Destination:=xWs.Range("A1")
For i = 1 To Worksheets.Count
If Worksheets.Select = "Vykazy_data" Then
End
End If
Worksheets(i).Range("A1").CurrentRegion.Offset(CInt(xTCount), 0).Copy _
Destination:=xWs.Cells(xWs.UsedRange.Cells(xWs.UsedRange.Count).Row + 1, 1)
Next
End Sub
I have this macro and I need help. " If Worksheets.Select = "Vykazy_data" Then End", this part dont work. Pls help with solution. I need to skip one worksheet in this loop
Private Sub CommandButton2_Click()
Dim i As Integer
Dim xTCount As Variant
Dim xWs As Worksheet
Application.DisplayAlerts = False
ActiveWorkbook.Worksheets("VÝSLEDEK").Delete
Application.DisplayAlerts = True
On Error Resume Next
LInput:
xTCount = Application.InputBox("počet řádků v hlavičce", "", "1")
If TypeName(xTCount) = "Boolean" Then Exit Sub
If Not IsNumeric(xTCount) Then
MsgBox "Napiš číslo"
GoTo LInput
End If
Set xWs = ActiveWorkbook.Worksheets.Add(Sheets(1))
xWs.Name = "VÝSLEDEK"
Worksheets(1).Range("A1").EntireRow.Copy Destination:=xWs.Range("A1")
For i = 1 To Worksheets.Count
If Worksheets.Select = "Vykazy_data" Then
End
End If
Worksheets(i).Range("A1").CurrentRegion.Offset(CInt(xTCount), 0).Copy _
Destination:=xWs.Cells(xWs.UsedRange.Cells(xWs.UsedRange.Count).Row + 1, 1)
Next
End Sub