+ Reply to Thread
Results 1 to 2 of 2

Looping I think??

  1. #1
    Registered User
    Join Date
    06-11-2007
    Posts
    4

    Looping I think??

    Hi people thought I would drop a quick line before I go To lunch, I have designed a form which updates the fields in an excel database automatically,

    I have the following code: -

    Set xlwbook = xl.Workbooks.Open("C:\Documents and Settings\callcentre.temp02\My Documents\Copy of LeadsNCL.xls")
    Set xlsheet = xlwbook.Sheets.Item(1)
    xlsheet.Cells(6, 2) = TextBox1.Text
    xlsheet.Cells(6, 3) = TextBox2.Text
    xlsheet.Cells(6, 4) = ComboBox1.Text
    xlsheet.Cells(6, 5) = TextBox3.Text
    xlsheet.Cells(6, 6) = TextBox4.Text
    xlsheet.Cells(6, 7) = TextBox5.Text
    xlsheet.Cells(6, 8) = TextBox6.Text
    xlsheet.Cells(6, 9) = TextBox7.Text
    xlsheet.Cells(6, 10) = ComboBox2.Text
    xlsheet.Cells(6, 11) = TextBox8.Text
    xlsheet.Cells(6, 12) = TextBox9.Text
    xlsheet.Cells(6, 13) = TextBox10.Text
    xlsheet.Cells(6, 14) = TextBox11.Text
    xlsheet.Cells(6, 15) = TextBox12.Text
    xlsheet.Cells(6, 16) = TextBox13.Text
    xlsheet.Cells(6, 17) = TextBox14.Text
    xlsheet.Cells(6, 18) = ComboBox3.Text
    xlsheet.Cells(6, 19) = TextBox15.Text
    xlsheet.Cells(6, 20) = TextBox16.Text
    xlsheet.Cells(6, 21) = ComboBox4.Text
    xlsheet.Cells(6, 22) = ComboBox5.Text
    xlwbook.Save

    The (6) relates to the row, when i add a new record i want the 6 to become 7 so that the data does not replace the previously entered data,

    I hope you understand what I am trying to say,

    If anyone can help me out with this it will be very much appreciated.

    Kind Regards

    Jimmy

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Please read forum rules below and then wrap your code

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ 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