+ Reply to Thread
Results 1 to 5 of 5

write code to copy a current variables value into next available cell in worksheet

  1. #1
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    write code to copy a current variables value into next available cell in worksheet

    I am attempting to put a variables value from program to worksheet. I have gotten it to write for individual cells but I need it to write to next available cell. The variables that need to be written are air pressure and volume water.

    Please Login or Register  to view this content.
    Thank you for any help
    Last edited by damayn83; 02-01-2013 at 04:31 PM.

  2. #2
    Registered User
    Join Date
    01-30-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: write code to copy a current variables value into next available cell in worksheet

    If by "next available cell" you mean the row below and column beside the used range, you could add this code:

    nNextRow = ActiveSheet.UsedRange.Rows.Count + 1
    nNextCol = ActiveSheet.UsedRange.Columns.Count + 1
    Cells(nNextRow, nNextCol).Value = air_pressure

  3. #3
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: write code to copy a current variables value into next available cell in worksheet

    Same column, next row down, worksheet2? What changes need to be made?

  4. #4
    Registered User
    Join Date
    01-30-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: write code to copy a current variables value into next available cell in worksheet

    This may help. It uses the current column of the active sheet, posts your numbers into sheet2 same column and next row, then returns to activesheet.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-18-2013
    Location
    Baton Rouge, LA
    MS-Off Ver
    MS Office 2010
    Posts
    25

    Re: write code to copy a current variables value into next available cell in worksheet

    Thank you for your help. The code is running great and writes where it needs to.

+ 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