Hi Again! I'm very new to VBA. I'm creating a macro to copy a range based upon a singular cell's value on an active sheet.
Sub copyreport()
If ActiveSheet.Range("W25").Value <= "5" Then
Range("A1:X37").Select
Range("X37").Activate
Application.CutCopyMode = False
Selection.Copy
ElseIf ActiveSheet.Range("W25").Value <= "10" Then
Range("A1:X45").Select
Range("X45").Activate
Application.CutCopyMode = False
Selection.Copy
ElseIf ActiveSheet.Range("W25").Value <= "15" Then
Range("A1:X53").Select
Range("X53").Activate
Application.CutCopyMode = False
Selection.Copy
ElseIf ActiveSheet.Range("W25").Value <= "20" Then
Range("A1:X61").Select
Range("X61").Activate
Application.CutCopyMode = False
Selection.Copy
End If
End Sub
What am I doing wrong in this setup? It doesn't copy the range if the Cell = 6 or 19. Cell W25 is only supposed to equal 1-20.
Thanks,
Sub copyreport()
If ActiveSheet.Range("W25").Value <= "5" Then
Range("A1:X37").Select
Range("X37").Activate
Application.CutCopyMode = False
Selection.Copy
ElseIf ActiveSheet.Range("W25").Value <= "10" Then
Range("A1:X45").Select
Range("X45").Activate
Application.CutCopyMode = False
Selection.Copy
ElseIf ActiveSheet.Range("W25").Value <= "15" Then
Range("A1:X53").Select
Range("X53").Activate
Application.CutCopyMode = False
Selection.Copy
ElseIf ActiveSheet.Range("W25").Value <= "20" Then
Range("A1:X61").Select
Range("X61").Activate
Application.CutCopyMode = False
Selection.Copy
End If
End Sub
What am I doing wrong in this setup? It doesn't copy the range if the Cell = 6 or 19. Cell W25 is only supposed to equal 1-20.
Thanks,