ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro help for changing data (cell location) in edit find box (https://www.excelbanter.com/excel-discussion-misc-queries/118346-macro-help-changing-data-cell-location-edit-find-box.html)

Jim

macro help for changing data (cell location) in edit find box
 
It keeps on keeping the same data in my macro.
It does not put new copied data into the find box
Can someone help me out w/ this?



There is an identifier # on each sheet. It was supposed to type the number
into the find box and then go to the 2nd sheet and find that number. Next to
that number is a name and it was supposed to copy over that name back on the
1st sheet. But the # in the find box never changes. I don't know how to
copy a new one in there each time I run the macro.

Sub Macro24()
'
' Macro24 Macro
' Macro recorded 11/7/2006 by jjt
'
' Keyboard Shortcut: Ctrl+g
'
Sheets("Sheet1").Select
Selection.Copy
Cells.Find(What:="987987", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
Sheets("Sheet2").Select
Selection.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, -1).Range("A1").Select
Application.CutCopyMode = False
Selection.Cut
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -2).Range("A1").Select
Sheets("Sheet2").Select
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlDown)).Select
Sheets("Sheet1").Select
End Sub


Allllen

macro help for changing data (cell location) in edit find box
 
your problem is with this part

Cells.Find(What:="987987", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate


instead of that use
dim stALLLLEN as string
stALLLLEN = inputbox("enter number to find")
Cells.Find(What:=stALLLLEN,After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate




--
Allllen


"JIM" wrote:

It keeps on keeping the same data in my macro.
It does not put new copied data into the find box
Can someone help me out w/ this?



There is an identifier # on each sheet. It was supposed to type the number
into the find box and then go to the 2nd sheet and find that number. Next to
that number is a name and it was supposed to copy over that name back on the
1st sheet. But the # in the find box never changes. I don't know how to
copy a new one in there each time I run the macro.

Sub Macro24()
'
' Macro24 Macro
' Macro recorded 11/7/2006 by jjt
'
' Keyboard Shortcut: Ctrl+g
'
Sheets("Sheet1").Select
Selection.Copy
Cells.Find(What:="987987", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
Sheets("Sheet2").Select
Selection.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 1).Range("A1").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Sheet1").Select
ActiveCell.Offset(0, 1).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(0, -1).Range("A1").Select
Application.CutCopyMode = False
Selection.Cut
ActiveCell.Offset(0, 2).Range("A1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, -2).Range("A1").Select
Sheets("Sheet2").Select
ActiveCell.Offset(0, -1).Range("A1").Select
Selection.End(xlUp).Select
Range(Selection, Selection.End(xlDown)).Select
Sheets("Sheet1").Select
End Sub



All times are GMT +1. The time now is 02:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com