Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick Question with selecting cells

I'm trying to get VBA to select the contents of a cell and stick it int
a variable for me. I need it formatted and so I'm trying the followin
but it doesn't work. Var is returned as "- 1"

Var = Format(Range(Row & Col).Select, "### #### ##")

tried this but it then sets Var to empty
Var = Format(Cells(Row, Col).Value, "### #### ##")


Can anybody help me

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Quick Question with selecting cells

Maybe try:

Var = Format(Range(Row & Col).Value, "###,###.00")
You may be running into problems w/ the spaces between # signs (not
recognized?). Or, you could also try:
Var = Application.WorksheetFunction.Text(Range(R & C).Value, "###,###.##")

Hope that helps.

Gaston < wrote:
I'm trying to get VBA to select the contents of a cell and stick it into
a variable for me. I need it formatted and so I'm trying the following
but it doesn't work. Var is returned as "- 1"

Var = Format(Range(Row & Col).Select, "### #### ##")

tried this but it then sets Var to empty
Var = Format(Cells(Row, Col).Value, "### #### ##")


Can anybody help me?


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Quick Question with selecting cells

An example that I've used in a long past app.

WSht.Cells(lfr, 4) = Format(BkrDet(ro, 1) / 100 * TotalComm, FmtMil)
Where, FmtMil = "#,###,##0.00;(#,###,##.00)"
--
Regards;
Rob
------------------------------------------------------------------------
"Gaston " wrote in message
...
I'm trying to get VBA to select the contents of a cell and stick it

into
a variable for me. I need it formatted and so I'm trying the following
but it doesn't work. Var is returned as "- 1"

Var = Format(Range(Row & Col).Select, "### #### ##")

tried this but it then sets Var to empty
Var = Format(Cells(Row, Col).Value, "### #### ##")


Can anybody help me?


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick Question with selecting cells

Woah. That was the problem. Wasn't recognizing spaces. Thanks
million.

However, I just have two minor problems now. The string I want t
extract from the cell needs to be the first 11 characters. How do
just chose, say the first 11 characters and discard the rest?

Also, if I want to get the last two characters of a 3 character string
how do I do this as well

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
RWN RWN is offline
external usenet poster
 
Posts: 104
Default Quick Question with selecting cells

Whatever = Left$(Whatever,11)
For the right - Guess, that's right ...=Right$(Whatever,2)


--
Regards;
Rob
------------------------------------------------------------------------
"Gaston " wrote in message
...
Woah. That was the problem. Wasn't recognizing spaces. Thanks a
million.

However, I just have two minor problems now. The string I want to
extract from the cell needs to be the first 11 characters. How do I
just chose, say the first 11 characters and discard the rest?

Also, if I want to get the last two characters of a 3 character

string,
how do I do this as well?


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Quick Question with selecting cells

Why, oh why do small little issues creep up time and time again? :|

Almost got this thing to work. It's printing numbers from one
spreadsheet to the next. There's yet ANOTHER small issue that's come
up.

When I get the address of the field in the second database(Format:
$C12) I use that to then copy and past another column of the same row
by extracting the 12. However, problems arise, since if rows aren't a
fixed lenght. How can I get it to extract the row when the format
changes(ie. I get addresses $C1, $C12, $C133, etc... variable size)

Thanks YET again...


---
Message posted from http://www.ExcelForum.com/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick question... NPell Excel Worksheet Functions 3 February 13th 09 03:37 PM
quick question Fady Excel Discussion (Misc queries) 7 February 23rd 08 04:59 AM
Quick Question Kory Excel Discussion (Misc queries) 1 July 21st 07 09:46 AM
quick question riggi Excel Discussion (Misc queries) 4 January 31st 07 06:11 AM
Quick Question Brian Hamilton Excel Worksheet Functions 2 October 27th 06 05:51 PM


All times are GMT +1. The time now is 04:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"