Excel macro help
Solved/Closed
Fi
-
Apr 29, 2011 at 01:10 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Apr 29, 2011 at 01:21 AM
venkat1926 Posts 1863 Registration date Sunday June 14, 2009 Status Contributor Last seen August 7, 2021 - Apr 29, 2011 at 01:21 AM
Related:
- Excel macro help
- Spell number in excel without macro - Guide
- Excel marksheet - Guide
- Excel apk for pc - Download - Spreadsheets
- Macros in excel download free - Download - Spreadsheets
- Kernel for excel - Download - Backup and recovery
1 response
venkat1926
Posts
1863
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
August 7, 2021
811
Apr 29, 2011 at 01:21 AM
Apr 29, 2011 at 01:21 AM
macro slightly modified
there is no need for so many selection. learn how to write a macro without selection
for e.g
instead of
Sheets("years").Select
ActiveSheet.Cells.Find(What:=Sheets("final").Range("I20").Value, After:=Range("A1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
you can just write
Sheets("years").Cells.Find(What:=Sheets("final").Range("I20").Value, After:=Range("A1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
in find method many of them are defaults and can be omitted. see help "find"
perhpas "what" and "lookat" are important.
Sub test() Sheets("years").Select ActiveSheet.Cells.Find(What:=Sheets("final").Range("I20").Value, After:=Range("A1"), LookIn:=xlFormulas, _ LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _ MatchCase:=False, SearchFormat:=False).Activate Range(Selection, Selection.End(xlDown)).Select Application.CutCopyMode = False Selection.Copy Sheets("runhours").Select Range("B2").Select ActiveSheet.Paste Sheets("FINAL").Select End Sub
there is no need for so many selection. learn how to write a macro without selection
for e.g
instead of
Sheets("years").Select
ActiveSheet.Cells.Find(What:=Sheets("final").Range("I20").Value, After:=Range("A1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
you can just write
Sheets("years").Cells.Find(What:=Sheets("final").Range("I20").Value, After:=Range("A1"), LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
in find method many of them are defaults and can be omitted. see help "find"
perhpas "what" and "lookat" are important.