Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am a basic excel user and here is my macro. I am trying to set whatever
sheet is open as the active sheet, pick a cell from that sheet value equal to LL-CP-0100 and assign a variable to the number part ie 0100. My such variable is "j" below. I also set a variable i which should equal j+1. Then i want to use i and j in the code as shown below. Can someone help clean the code. ' Macro recorded 9/30/2004 by Husky User ' Sub Atester() Dim sStr As String Dim pos As Long Dim i As Long Dim j As Long Windows"current sheet".Activate Range("J2").Select sStr = "J2" pos = InStrRev(sStr, "-") i = Mid(sStr, pos + 1) + 1 j = i - 1 MsgBox i MsgBox j Windows("LL-CP-j.xls").Activate Range("F3:H3").Select Application.CutCopyMode = False Selection.Copy Windows("Completions LL Register 2004-09-030.xls").Activate Range("F"i"").Select Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
clean up code a little | Excel Discussion (Misc queries) | |||
Clean Up Code - consolidate steps | Excel Discussion (Misc queries) | |||
Help clean up this code... | Excel Programming | |||
Clean up code using WITHs | Excel Programming | |||
Plase help me clean up my code | Excel Programming |