Urgent help please in macro, VB
Closed
BJ
-
Dec 13, 2010 at 03:34 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Dec 15, 2010 at 04:36 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Dec 15, 2010 at 04:36 AM
Related:
- Urgent help please in macro, VB
- Spell number in excel without macro - Guide
- Macros in excel download free - Download - Spreadsheets
- Excel macro to create new sheet based on value in cells - Guide
- Vb editor download - Download - IDE
- Vb select case - Guide
1 response
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Dec 15, 2010 at 04:36 AM
Dec 15, 2010 at 04:36 AM
It is not clear where in sheeet1 the account numbers are entered. I assume it is column A. If it is different column you modify the macro the line
With Worksheets("sheet1").Columns("A:A")
the sheet names are sheet1 and sheet 2 and not sheetone and sheettwo.
KEEP YOUR ORIGINAL FILE SAFELY SOMEWHERE SO THAT THE FILE CAN BE RETRIEVED IF THERE IS A MESS UP.
THE MACRO IS
With Worksheets("sheet1").Columns("A:A")
the sheet names are sheet1 and sheet 2 and not sheetone and sheettwo.
KEEP YOUR ORIGINAL FILE SAFELY SOMEWHERE SO THAT THE FILE CAN BE RETRIEVED IF THERE IS A MESS UP.
THE MACRO IS
Sub test() Dim j, cfind As Range, add As String With Worksheets("sheet2") j = .Range("E4").Value End With With Worksheets("sheet1").Columns("A:A") Set cfind = .Cells.Find(what:=j, lookat:=xlWhole) If Not cfind Is Nothing Then cfind.EntireRow.Copy add = cfind.Address Else Exit Sub End If With Worksheets("sheet2") .Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial End With Do Set cfind = .Cells.FindNext(cfind) If cfind Is Nothing Then Exit Do If cfind.Address = add Then Exit Do cfind.EntireRow.Copy With Worksheets("sheet2") .Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial End With Loop End With Application.CutCopyMode = False End Sub