![]() |
Determining and presenting unique entries?
I have an app in which a certain subset of data can actually be used. I
have no problem in determining which data has in fact been used, but I want a VBA routine that can look through a range (in which the used data appears) and copy them to consecutive cells (with no blanks in between). An example would be an itemized list, where only the used item appear. Eg. Initial column data Wanted data presentation Blank Test 1 Test 1 Test 2 Blank Test 3 Blank Test 2 Test 3 Blank Hope this is clear. Any help would be appriciated. Simon |
Determining and presenting unique entries?
|
Determining and presenting unique entries?
Assuming you are using col A and B and assuming you have headers in A1 and B1
with data starting in A2=blank A3=Test1 A4=blank etc and assuming that when you say that the data is "actually used" then the data must be in a particular row and that the first cell of that row ("A??") will not be blank, then the following will copy whatever is found in Col A cell to Col B cells: This will produce the image you showed in your post Option Explicit Private Sub FindNonBlanks() Dim c As Range Dim LastC As Range Dim i As Integer Set LastC = Range("A65354").End(xlUp) For Each c In Range("A2", LastC) If c < "" Then Range("B2").Offset(i, 0) = c.Value i = i + 1 End If Next c End Sub " wrote: I have an app in which a certain subset of data can actually be used. I have no problem in determining which data has in fact been used, but I want a VBA routine that can look through a range (in which the used data appears) and copy them to consecutive cells (with no blanks in between). An example would be an itemized list, where only the used item appear. Eg. Initial column data Wanted data presentation Blank Test 1 Test 1 Test 2 Blank Test 3 Blank Test 2 Test 3 Blank Hope this is clear. Any help would be appriciated. Simon |
Determining and presenting unique entries?
This works perfectly! Thanks very much.
|
All times are GMT +1. The time now is 12:36 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com