Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'm attempting to extract the data in a cell to the right of a hyphen("-") and place it in a variable. I thought I could use the code below, but it causes a compile error "Function or Sub not defined". The word "Find" is highlighted and seems to be causing the error. Does anyone have any suggestions? Once I get past the error, I might have to adjust the code to make sure I'm getting the data I want. Thanks The contents of D4 is "9/1/2005-3/31/2006". I need the "3/31/2006". The workbook has multiple sheets. The cell I want is on worksheet "Report Current". Code: -------------------- Sub Getit() Dim GetRight As String Worksheets("Report Current").Select GetRight = (Right(D4, Len(D4), Find("" - "", D4) - 1)) End Sub -------------------- -- DavidW ------------------------------------------------------------------------ DavidW's Profile: http://www.excelforum.com/member.php...o&userid=32630 View this thread: http://www.excelforum.com/showthread...hreadid=534595 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Replace first hyphen in a cell | Excel Discussion (Misc queries) | |||
Adding hyphen to text in cell | Excel Discussion (Misc queries) | |||
Cell format - put hyphen where zero value would be. | New Users to Excel | |||
hyphen (nit minus) in cell | Excel Discussion (Misc queries) | |||
Entering a hyphen into a cell | Excel Worksheet Functions |