Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a variable called "myMonth". I would like this
variable to be set to the first three text characters in cell "G3". For instance, if G3 is January, I'd like for myMonth to equal "Jan" I know that in Excel, I would have the formula be =left (D3,3). How do I put this into VB code? Thanks, Mike. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mike,
It's very similar to the worksheet function: myMonth = Left$(Sheets("Sheet1").Range("G3").Value, 3) You may want to use .Text instead of .Value, depending on what is actually stored in the cell - the Text property returns the text displayed to the user, while the Value property returns the actual value of the cell. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Mike wrote: I have a variable called "myMonth". I would like this variable to be set to the first three text characters in cell "G3". For instance, if G3 is January, I'd like for myMonth to equal "Jan" I know that in Excel, I would have the formula be =left (D3,3). How do I put this into VB code? Thanks, Mike. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
sVar = Left(Worksheets(1).Cells(3, 4).Value, 3) - Pikus
--- Message posted from http://www.ExcelForum.com/ |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Jake!
-----Original Message----- Hi Mike, It's very similar to the worksheet function: myMonth = Left$(Sheets("Sheet1").Range("G3").Value, 3) You may want to use .Text instead of .Value, depending on what is actually stored in the cell - the Text property returns the text displayed to the user, while the Value property returns the actual value of the cell. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Mike wrote: I have a variable called "myMonth". I would like this variable to be set to the first three text characters in cell "G3". For instance, if G3 is January, I'd like for myMonth to equal "Jan" I know that in Excel, I would have the formula be =left (D3,3). How do I put this into VB code? Thanks, Mike. . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You're welcome, Mike - glad to help!
-- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Mike wrote: Thanks, Jake! -----Original Message----- Hi Mike, It's very similar to the worksheet function: myMonth = Left$(Sheets("Sheet1").Range("G3").Value, 3) You may want to use .Text instead of .Value, depending on what is actually stored in the cell - the Text property returns the text displayed to the user, while the Value property returns the actual value of the cell. -- Regards, Jake Marx MS MVP - Excel www.longhead.com [please keep replies in the newsgroup - email address unmonitored] Mike wrote: I have a variable called "myMonth". I would like this variable to be set to the first three text characters in cell "G3". For instance, if G3 is January, I'd like for myMonth to equal "Jan" I know that in Excel, I would have the formula be =left (D3,3). How do I put this into VB code? Thanks, Mike. . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Since Cells(3,4) refers to D3 rather than G3 as requested, and otherwise,
your post pretty much duplicates what Mr. Marx said, what was the added value of your post? I don't want to miss the important message you intended to convey. -- Regards, Tom Ogilvy "pikus" wrote in message ... sVar = Left(Worksheets(1).Cells(3, 4).Value, 3) - Pikus --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Get characters on left of specified character in Excel | Excel Discussion (Misc queries) | |||
testing for left 2 characters in set of 3 choices | Excel Worksheet Functions | |||
Find duplicates with left 4 characters | Excel Discussion (Misc queries) | |||
Excel 2003, SUM left-most characters | Excel Worksheet Functions | |||
HOW DO I EXTRACT ALL CHARACTERS AFTER 5 CHARACTERS ON LEFT | Excel Worksheet Functions |