Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
How to use comma separated inputs in macro
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Rick Rothstein, post: 6424747"] I think this macro will do what you want, just assign the appropriate sheet names to the two Const (constant) statements (and rename the macro to something more appropriate)... Sub CopyNonSpecifiedColumnBItemRows() Dim UserInput As String, UserList() As String, Cell As Range Dim SourceLastRow As Long, DestinationLastRow As Long Const Source As String = "Sheet4" Const Destination As String = "NewSheet" SourceLastRow = Worksheets(Source).Cells(Rows.Count, "B").End(xlUp).Row DestinationLastRow = Worksheets(Destination).Cells( _ Rows.Count, "B").End(xlUp).Row UserInput = InputBox("List items separated by commas", "Get User List") If Len(UserInput) Then UserInput = "," & Replace(UserInput, " ", "") & "," For Each Cell In Worksheets(Source).Range("B1:B" & SourceLastRow) If InStr(1, UserInput, "," & Cell.Value & ",", vbTextCompare) = 0 Then Cell.EntireRow.Copy Worksheets(Destination).Cells(DestinationLastRow, "A") DestinationLastRow = DestinationLastRow + 1 End If Next End If End Sub [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
How to use comma separated inputs in macro
Top