Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 06-12-2015, 01:22 PM
BIMwit BIMwit is offline Someone please check my macro Windows 7 64bit Someone please check my macro Office 2013
Novice
Someone please check my macro
 
Join Date: May 2015
Posts: 4
BIMwit is on a distinguished road
Default Thank you

I had planned to fix it myself, I just needed a little guidance which you provided. It took a little head scratching to decipher some of what you posted and a little help from the VBA editor...but I got it to work. So again, thank you. Posting the final version here for anyone who might be looking for it.

Sub SearchForString()

Dim LSearchRow As Integer
Dim LCopyToRow As Integer

On Error GoTo Err_Execute

'Start search in row 3
LSearchRow = 3

'Start copying data to row 3 in "End" Sheet (row counter variable)
LCopyToRow = 3

While Len(Range("B" & CStr(LSearchRow)).Value) > 0

'If value in column K = TRUE, copy entire row to "End" Sheet
If Range("K" & CStr(LSearchRow)).Value = True Then

'Select row in "Start" to copy
Range("B" & CStr(LSearchRow) & ":I" & CStr(LSearchRow)).Copy

'Paste row into "End" in next row
Sheets("End").Select
Range("A" & CStr(LCopyToRow)).PasteSpecial

'Move counter to next row
LCopyToRow = LCopyToRow + 1

'Go back to "Start" to continue searching
Sheets("Start").Select

End If

LSearchRow = LSearchRow + 1

Wend

'Position on cell A3
Application.CutCopyMode = False
Range("A3").Select

MsgBox "All matching data has been copied."

Exit Sub

Err_Execute:
MsgBox "An error occurred."

End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to check dropdown value and increment a counter rkferguson Word VBA 8 01-07-2015 11:08 PM
Someone please check my macro Tying a check box to a macro/VBA to customize a document mhblake Word VBA 3 12-04-2013 04:17 PM
Someone please check my macro Macro for check box in word Jeannie Cornia Word 3 01-21-2013 06:00 AM
Check box macro help needed Aflac Word 4 03-24-2012 07:11 PM
Someone please check my macro Check Box Macro Johnny thunder Word VBA 12 04-07-2011 04:47 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:16 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft