Results 1 to 2 of 2
  1. #1
    Ballen is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    1

    Question VBA to Find First Empty Cell in a Row and Insert Text

    Hello -



    Hoping someone can help me with my translation of Excel VBA to Access. I'm using Access to export the results of a query to Excel and within the same code I am opening up the spreadsheet to format it. Part of the formatting requires me to find the first empty cell in column A, and then insert the text 'Summary'.

    Within Excel, the following code works:
    Find empty cell:
    Code:
    Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Select
    Add term 'Summary' to cell:
    Code:
    ActiveCell.FormulaR1C1 = "Summary"
    I've tried a few different things based on some code I've found on the net from similar situations, but in just about all attempts I get an object defined error. I've tried dimming the piece of code as an object, but when it comes to VBA, I'm just fumbling through.

    Any help would be greatly appreciated.

    Thanks

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you want code in Access to manipulate the Excel then need to declare Excel objects.

    Review links in this thread http://forums.aspfree.com/microsoft-...el-414974.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-23-2012, 10:13 PM
  2. Replies: 4
    Last Post: 11-20-2011, 01:08 PM
  3. Replies: 1
    Last Post: 10-12-2011, 08:07 AM
  4. Replies: 0
    Last Post: 02-27-2011, 07:03 AM
  5. Can we post Access cell data to Excel cell properties?
    By Zethro in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2005, 08:42 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums