Home |
Search |
Today's Posts |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
VBA is over my head. I use the cheat method and let the macro copy what I
want to do. Here is the macro I ended up with and it works! The search is not part of the macro. I am searching through 30,000 addresses for a specific one and then printing the results based on the cell the address is found in. ActiveCell.Rows("1:1").EntireRow.Select ActiveCell.Activate Selection.Copy Sheets("PRINT").Select ActiveCell.Select Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=True ActiveCell.Offset(0, -1).Range("A1:B44").Select Application.CutCopyMode = False Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With ActiveWindow.SelectedSheets.PrintOut Copies:=3, Collate:=True ActiveCell.Offset(0, 1).Range("A1:A44").Select Selection.ClearContents ActiveCell.Select Sheets("LBE_Mailfile_May_2006_PRINT").Select Application.Goto Reference:="R2C4" End Sub "JMB" wrote: Maybe something similar to this? You will need to change the Criteria to what you are looking for. Also, review the parameters of the Find method. I made assumptions about how you want to perform the search (refer to help in VBA for the Find Method and its parameters). Also, you may need to change the destination for the transposed data. I put it in Sheet2, cell A1. Sub Test() Const Criteria As String = "Joe" Dim rngFound As Range Set rngFound = Cells.Find(what:=criteria, _ after:=Cells(1, 1), LookIn:=xlValues, _ lookat:=xlWhole, searchorder:=xlByRows, _ searchdirection:=xlNext, MatchCase:=False, _ matchbyte:=False) rngFound.EntireRow.Copy Worksheets("Sheet2").Range("A1").PasteSpecial Paste:=xlAll, _ Operation:=xlPasteSpecialOperationNone, skipblanks:=false, _ Transpose:=True Application.CutCopyMode = False Worksheets("Sheet2").PrintOut End Sub "marwildfw" wrote: I want to use the search function to find specific data and then use a macro to select the entire row and transpose it into a column and then print the data. The macro works but it selects the same row every time. I want to know how to tell the macro to start in the current cell. I use the record function to create the macro, so a simple solution would be appreciated. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
getting a simple macro to begin execution on the selected cell | Excel Discussion (Misc queries) | |||
Macro to run relative to current selected cell | Excel Discussion (Misc queries) | |||
In Excel 2002 macro, go to cell in current row. | Excel Programming | |||
Want macro to select current cell | Excel Programming | |||
Macro to copy current cell | Excel Programming |