Results 1 to 4 of 4
  1. #1
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839

    Access VBA deleting an active excel spreadsheet column.

    I want to delete a column on a spreadsheet before it saves.



    I have seen something where worksheetC.EntireColumn.Delete() the () is the range, but makes Access VBA ask for = or I put in the range (xlRange), then it gives me a method or data member not found on the .EntireColumn

    Thanks

  2. #2
    ranman256's Avatar
    ranman256 is online now VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    record the macro in excel, do the steps, stop macro.
    then plug that code into an excel block below...

    Code:
    Set XL = CreateObject("excel.application")
    With XL
        .Visible = True
        .Workbooks.Open "c:\folder\file.xls"
        .Columns("D:D").Select
        .Selection.Delete Shift:=xlToLeft
    End With
    End Sub

  3. #3
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Thanks ranman,
    I figured this out:

    wkSheetC.Columns.Range("A:C,E:G,I:M").Delete

    I understand this is column specific and tailored to certain layout.

  4. #4
    Thompyt is offline Expert
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2014
    Location
    El Paso, TX
    Posts
    839
    Now I am looking at deleting rows where the row is null

    I am trying:

    For iRow = 2 to 3002

    Code:
    If IsNull(wkSheetC.Rows(iRow)) Then
                    wkSheetC.Rows(iRow).Delete
                End If
    It runs through, but doesn't delete any rows. It seems that the row isn't considered as a null.

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

Similar Threads

  1. Format an Excel spreadsheet from Access
    By crowegreg in forum Programming
    Replies: 4
    Last Post: 12-23-2013, 07:12 PM
  2. Replies: 1
    Last Post: 11-26-2012, 12:35 PM
  3. Creating excel spreadsheet from access vba
    By nyneave in forum Programming
    Replies: 1
    Last Post: 10-12-2012, 09:59 AM
  4. Open Excel spreadsheet in Access
    By carlyd in forum Forms
    Replies: 1
    Last Post: 02-17-2012, 01:09 PM
  5. Email Excel Spreadsheet from Access
    By Nancy in forum Access
    Replies: 2
    Last Post: 11-09-2010, 02:37 PM

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