+ Reply to Thread
Results 1 to 3 of 3

adding a formula upto the last row of data

Hybrid View

  1. #1
    Registered User
    Join Date
    04-17-2009
    Location
    Redditch
    MS-Off Ver
    Excel 2003
    Posts
    36

    adding a formula upto the last row of data

    Every day i have to pull of a text document from a server and import it into excel so i can change the format of certain columns. Then import the data into a database. I am trying to create a macro that will enable me to make these changes instantly without having to spend minutes on them.

    There is once column that has the format 2009-03-12-10:02:09 which indicates date and time however there is a - inbetween them. I know that i can use =DateValue(left(a1,10))+ Time alue(right(a1,8)) and then format the cells to date and time to remove the -. My issue is that i only want to use the formula upto the last row of data otherwise i end up importing blank rows into my database.

    Does anyone know of a way i can do this?
    Last edited by boomshank; 05-14-2009 at 05:31 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: adding a formula upto the last row of data

    Perhaps along the lines of:

    Public Sub Insert_Formulae()
    Range(Cells(1, "A"), Cells(Rows.Count, "A").End(xlUp)).Offset(, 1).FormulaR1C1 = "=0+SUBSTITUTE(RC1,""-"","" "",3)"
    End Sub

  3. #3
    Registered User
    Join Date
    04-17-2009
    Location
    Redditch
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: adding a formula upto the last row of data

    Thanks, That worked brilliantly

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1