![]() |
How to find the unique cell value?
I build the following code to search from a searchrow (PG_Begin) in
sheet assumptions with a loop. I notice that cells.find doesn't find a unique cell and I want to know what code I must use to let the macro find the unique cellvalue requested?? For example, if the searchvalue is net_val-1 the copied column is net_val-1_YTD which is ofcourse not the column I wanted to be copied. Sub CommandButton3_Click() On Error GoTo ErrorHandler Application.ScreenUpdating = False Application.Goto Reference:="PG_Begin" Row = ActiveCell.Row While ActiveSheet.Cells(Row, 1).Value < "" PG = ActiveSheet.Cells(Row, 1).Value Sheets("olap").Select Cells.Find(What:=PG, After:=ActiveCell, LookIn:=xlFormulas _ , LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False).Activate ActiveCell.EntireColumn.Select ActiveCell.EntireColumn.Copy ActiveSheet.Paste (Sheets("extract").Range("ia1").End(xlToLeft).Offs et(, 1)) Sheets("Assumption").Select Row = Row + 1 Wend Sheets("extract").Select Columns("A:A").Select Selection.Delete Shift:=xlToLeft MsgBox ("correcting OLAP extract completed") ErrorHandler: Application.ScreenUpdating = True MsgBox (Err.Description) End Sub |
All times are GMT +1. The time now is 12:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com