S
Steve
Hello All. I have a bit of code below (compliments of Garry S) that
takes rows that meet a certain criteria and chunks them to a different
worksheet. In this code, the specvific "target" worksheet is
explicitly names in the code.
Is there a way to execute the code, have a "pop-up" box listing all
the current sheet names in the workbook, and allow the user choose
which worksheet to chunk the data to? So in the code below, the Set
wksTarget = Sheets("East") would be dynamic based on user input?
Thank you!
Dim wksSource As Worksheet, wksTarget As Worksheet
Set wksSource = ActiveSheet: Set wksTarget = Sheets("East")
Application.ScreenUpdating = False
With wksTarget
.Rows("1:" & CStr(.UsedRange.Rows.Count)).ClearContents
.Rows("1:" & CStr(.UsedRange.Rows.Count)).ClearComments
.Rows("1:" & CStr(.UsedRange.Rows.Count)).Interior.ColorIndex =
xlNone
End With
With wksSource
.Columns("K:K").AutoFilter Field:=1, Criteria1:="Y"
.UsedRange.Copy wksTarget.Rows("1:1")
.Columns("K:K").AutoFilter
End With
Application.ScreenUpdating = True
takes rows that meet a certain criteria and chunks them to a different
worksheet. In this code, the specvific "target" worksheet is
explicitly names in the code.
Is there a way to execute the code, have a "pop-up" box listing all
the current sheet names in the workbook, and allow the user choose
which worksheet to chunk the data to? So in the code below, the Set
wksTarget = Sheets("East") would be dynamic based on user input?
Thank you!
Dim wksSource As Worksheet, wksTarget As Worksheet
Set wksSource = ActiveSheet: Set wksTarget = Sheets("East")
Application.ScreenUpdating = False
With wksTarget
.Rows("1:" & CStr(.UsedRange.Rows.Count)).ClearContents
.Rows("1:" & CStr(.UsedRange.Rows.Count)).ClearComments
.Rows("1:" & CStr(.UsedRange.Rows.Count)).Interior.ColorIndex =
xlNone
End With
With wksSource
.Columns("K:K").AutoFilter Field:=1, Criteria1:="Y"
.UsedRange.Copy wksTarget.Rows("1:1")
.Columns("K:K").AutoFilter
End With
Application.ScreenUpdating = True