Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Name.Add problem
I am trying to set a range based on a fixed first cell and finding the last
cell in the column with data and assigning it a variable name to be used in the Selection.add.name code. The string variable displays the correct range when I step through it but does not work in the Find statement. What have I done wrong? Thank you. 'Set cells for range name Dim strLastInA As String Range("A6500").Select Selection.End(xlUp).Select strLastInA = "A4:" & ActiveCell.Address ActiveSheet.Names.Add Name:="RepUnitAbbr", RefersTo:=strLastInA ' Cells.Range(RepUnitAbbr).Replace What:="SBMU", Replacement:="S ", Lookat:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, searchformat:=False, _ ReplaceFormat:=False |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Name.Add problem
TRy this
'Set cells for range name Range(Range("A4"), Range("A" & Rows.Count).End(xlUp)).Name = "RepUnitAbbr" ' Range(RepUnitAbbr).Replace What:="SBMU", _ Replacement:="S ", _ Lookat:=xlPart, _ SearchOrder:=xlByRows, _ MatchCase:=False, _ searchformat:=False, _ ReplaceFormat:=False -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Billy B" wrote in message ... I am trying to set a range based on a fixed first cell and finding the last cell in the column with data and assigning it a variable name to be used in the Selection.add.name code. The string variable displays the correct range when I step through it but does not work in the Find statement. What have I done wrong? Thank you. 'Set cells for range name Dim strLastInA As String Range("A6500").Select Selection.End(xlUp).Select strLastInA = "A4:" & ActiveCell.Address ActiveSheet.Names.Add Name:="RepUnitAbbr", RefersTo:=strLastInA ' Cells.Range(RepUnitAbbr).Replace What:="SBMU", Replacement:="S ", Lookat:=xlPart, _ SearchOrder:=xlByRows, MatchCase:=False, searchformat:=False, _ ReplaceFormat:=False |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Colon at the end of excel file name(ex: problem.xls:1, problem.xls | New Users to Excel | |||
Started out as an Access problem. Now an Excel problem | Excel Discussion (Misc queries) | |||
problem with a conditional max problem | Excel Discussion (Misc queries) | |||
Problem when multipple users access shared xl-file at the same time, macrocode for solve this problem? | Excel Programming |