Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Tab key oly moves cursor to left | Excel Discussion (Misc queries) | |||
move cursor on one sheet moves cursor on all sheets | Excel Discussion (Misc queries) | |||
Page moves instead of cursor | Excel Discussion (Misc queries) | |||
Cursor stays still, page moves | Excel Discussion (Misc queries) | |||
Macro That Moves Cursor Down | Excel Programming |