Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Select rows that are 'blinking'

Hi Johan,

Am Sat, 26 Nov 2016 14:42:45 +0100 schrieb Claus Busch:

try following macro. Modify the sheet names where necessary:

Sub CopyRows2()


if you want it case sensitive then try:

Sub CopyRows3()
Dim wshS As Worksheet, wshT As Worksheet
Dim wbkS As Workbook, wbkT As Workbook
Dim varFilter As Variant, varTmp() As String
Dim varData As Variant, varRows() As Variant
Dim myDic As Object
Dim i As Long, LrowS As Long, n As Long, j As Long, LCol As Long
Dim rngC As Range
Dim myPath As String

Set wbkS = ActiveWorkbook
Set wshS = wbkS.ActiveSheet
Application.ScreenUpdating = False

With wshS
LrowS = .Cells(.Rows.Count, "A").End(xlUp).Row
varData = .Range("A1:A" & LrowS)
For Each rngC In Intersect(Selection, .Columns("A"))
ReDim Preserve varTmp(n)
varTmp(n) = rngC
n = n + 1
Next

Set myDic = CreateObject("Scripting.Dictionary")
For i = LBound(varTmp) To UBound(varTmp)
myDic(varTmp(i)) = varTmp(i)
Next
varFilter = myDic.items
n = 0
For i = LBound(varFilter) To UBound(varFilter)
For j = 2 To UBound(varData)
If StrComp(varData(j, 1), varFilter(i), vbBinaryCompare) = 0 Then
ReDim Preserve varRows(n)
varRows(n) = j
n = n + 1
End If
Next
Next
myPath = wbkS.Sheets("Sheet1").Range("F2")
If Dir(myPath) < "" Then
Set wbkT = Workbooks.Open(myPath)
Set wshT = wbkT.Sheets("Sheet1")
wshT.UsedRange.ClearContents
Else
MsgBox "Workbook not available. Macro is canceled"
End If
n = 2
For i = LBound(varRows) To UBound(varRows)
.Rows(varRows(i)).Copy wshT.Cells(n, 1)
n = n + 1
Next
End With
wshT.Range("X2").Resize(UBound(varRows) + 1) = Format(Now, "dd.Mm.yyyy \/ hh:mm:ss")

wbkT.Close savechanges:=True
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
--
Windows10
Office 2016
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i randomly select 780 rows from 4000 rows of data bbb Excel Worksheet Functions 2 July 6th 07 08:21 PM
Trying to select rows Arne Hegefors Excel Programming 4 July 20th 06 05:22 PM
select rows [email protected] Excel Worksheet Functions 1 March 1st 06 03:57 AM
select block of rows w/data between blank rows Janna Excel Programming 6 February 13th 05 02:45 AM
Unable to select rows in the repeat rows on top option Noppie Excel Discussion (Misc queries) 2 December 28th 04 03:17 PM


All times are GMT +1. The time now is 04:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"