Results 1 to 4 of 4

VBA Macro - Alteration of current macro to ignore hidden cells :)

Threaded View

Defratos VBA Macro - Alteration of... 01-14-2013, 02:20 AM
Defratos Re: Help please! VBA Macro -... 01-14-2013, 06:26 AM
nilem Re: Help please! VBA Macro -... 01-14-2013, 07:26 AM
Defratos Re: VBA Macro - Alteration of... 01-14-2013, 07:45 AM
  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    London
    MS-Off Ver
    Excel 2007
    Posts
    13

    VBA Macro - Alteration of current macro to ignore hidden cells :)

    Hi everyone.

    I currently am using the code below, which extracts data from several excel sheets into one database.

    Sub ExtractInfo()
    Dim fileToOpen, n&: Application.ScreenUpdating = False
    Dim wsh As Worksheet: Set wsh = ActiveSheet    ' the consolidation spreadsheet
    fileToOpen = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*", , , , True)    ' obtain the path and filename
    For n = 1 To UBound(fileToOpen)   ' the main loop to open all files and extract data
        With Workbooks.Open(fileToOpen(n))
            With .Sheets("Input File")
                'now go to the consolidation spreadsheet'enter the values'to start on "A4" and then skip to next row with next file
                wsh.Range("A3:I3").Offset(n).Value = WorksheetFunction.Transpose(.Range("C4:C12").Value)
                wsh.Range("J3:K3").Offset(n).Value = WorksheetFunction.Transpose(.Range("C16:C17").Value)
                wsh.Range("L3:R3").Offset(n).Value = WorksheetFunction.Transpose(.Range("F4:F10").Value)
                wsh.Range("S3:AD3").Offset(n).Value = WorksheetFunction.Transpose(.Range("C23:C34").Value)
            End With
            .Close 0
        End With
    Next n   'go and start the process over again with the next spreadsheet
    Application.ScreenUpdating = True
    End Sub
    Within this macro, i would like the line of code below to cause those cells which are hidden to show up as "0" if possible.

      wsh.Range("S3:AD3").Offset(n).Value = WorksheetFunction.Transpose(.Range("C23:C34").Value)
    For example, if the data is only from "C23 to C28" then the rest will appear as 0 on the database .
    Last edited by Defratos; 01-14-2013 at 07:43 AM.

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