LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default develop an if then else loop in excell that follows cursor moves

I'm not sure if I understood what you mean with (cursor movement**end (to get
cursor to the far right in the cell) left arrow, left arrow insert / left
arrow, left arrow, left arrow, insert /), but I supose you want to edit the
number to represent a date, right?
let's supose your date is in cell A2.
If your column is a number like 02242006 witch means 02/24/2006 then we can
convert it to a text using:
cells("A2") = format(left(cells("A2"), 2), "00") & "/" &
format(mid(cells("A2"), 3,2),"00") & "/" & format(right(cells("A2"), 4),
"0000")

within a loop it will look like:
r = 2
'your initial row
do while cells(r,1)0
cells(r,1) = format(left(cells(r,1), 2), "00") & "/" &
format(mid(cells(r,1), 3,2),"00") & "/" & format(right(cells(r,1), 4), "0000")
r=r+1
loop

--
Rogerio Takejame
Americana - Sao Paulo - Brazil


"Singforyou1954" wrote:

I need to manage data that I pull in from an SQL data base where the collumn
that is supposed to hold dates is a number field. I would like to be able to
write a macro to do a loop that goes down the colloumn and says if cell < 0
then (cursor movement**end (to get cursor to the far right in the cell) left
arrow, left arrow insert / left arrow, left arrow, left arrow, insert /) else
end. I cannot seem to write one that does not copy the cell above and I am
very rusty in vba. Thank you for your help

 
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
Tab key oly moves cursor to left Driftwood Excel Discussion (Misc queries) 3 June 29th 09 01:48 PM
move cursor on one sheet moves cursor on all sheets tdworden Excel Discussion (Misc queries) 2 July 22nd 07 10:50 PM
Page moves instead of cursor Ralphael1 Excel Discussion (Misc queries) 2 December 23rd 06 12:14 PM
Cursor stays still, page moves StephanieH Excel Discussion (Misc queries) 2 February 28th 06 06:33 PM
Macro That Moves Cursor Down job1job1 Excel Programming 3 February 16th 04 09:44 PM


All times are GMT +1. The time now is 02:47 AM.

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"