Results 1 to 18 of 18

Loop writing blank cells

Threaded View

cnash52 Loop writing blank cells 03-03-2016, 01:21 PM
Kevin# Re: Loop writing blank cells 03-03-2016, 02:19 PM
cnash52 Re: Loop writing blank cells 03-03-2016, 02:36 PM
Kevin# Re: Loop writing blank cells 03-03-2016, 02:49 PM
cnash52 Re: Loop writing blank cells 03-03-2016, 03:21 PM
Kevin# Re: Loop writing blank cells 03-03-2016, 04:10 PM
cnash52 Re: Loop writing blank cells 03-03-2016, 04:17 PM
Kevin# Re: Loop writing blank cells 03-03-2016, 05:04 PM
cnash52 Re: Loop writing blank cells 03-03-2016, 05:11 PM
Kevin# Re: Loop writing blank cells 03-04-2016, 09:41 AM
cnash52 Re: Loop writing blank cells 03-04-2016, 09:48 AM
Kevin# Re: Loop writing blank cells 03-04-2016, 11:03 AM
cnash52 Re: Loop writing blank cells 03-04-2016, 01:23 PM
cnash52 Re: Loop writing blank cells 03-09-2016, 08:49 AM
Kevin# Re: Loop writing blank cells 03-09-2016, 09:15 AM
Kevin# Re: Loop writing blank cells 03-09-2016, 10:05 AM
cnash52 Re: Loop writing blank cells 03-10-2016, 12:21 PM
Kevin# Re: Loop writing blank cells 03-10-2016, 12:43 PM
  1. #1
    Registered User
    Join Date
    09-13-2012
    Location
    Maine
    MS-Off Ver
    Excel 2010
    Posts
    45

    Loop writing blank cells

    Something in the For = A loop is preventing all the cells from being rewritten correctly.

    For some reason cell AF4 is the first cell of many not to be written over to the new sheet.
    Excel.JPG

    That cell should have written a converted value in the new sheet cell D2.
    Excel.JPG

    Dim WS As Worksheet
    Dim UpchainFile As String, DownchainFile As String
    Dim LastRow As Long
    Dim LastCol As Long
    Dim i As Integer
    Dim A As Long, B As Long
    Dim C As Integer
    
    
        Set WS = ActiveWorkbook.Sheets("Start")
        UpchainFile = Range("B8")
        DownchainFile = Range("B9")
        WS.Cells(10, 2).Value = ComboBoxPin.Value
        WS.Cells(11, 2).Value = ComboBoxStartStation.Value
        
    'Add Vision Upchain output file to current workbook
    
    Set WS = ActiveWorkbook.Sheets("Upchain")
    
    With WS.QueryTables.Add(Connection:="TEXT;" & UpchainFile, Destination:=WS.Range("A1"))
         .TextFileParseType = xlDelimited
         .TextFileCommaDelimiter = True
         .Refresh
    End With
    
    
    'Slim down the upchain data based on user preference
    
    With WS
    
    'Enter Header titles in Upchain Edit Sheet
    
        For C = 1 To 43
            Worksheets("Upchain Edit").Cells(1, C + 1).Value = (-2.2 + C / 10)
        Next
    
    'Slim down the upchain data based on user preference
    
        LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
        LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
        i = 1
            For A = 2 To LastRow 'label rows as A, A=1 at row 2
                If .Cells(A, 5) > 0 Then
                i = i + 1
                For B = 8 To LastCol 'label columns as B, B=1 at column H
                    'Enter 39 laser readings to string at 1/10th of a meter spacing (about 4in)
                    For C = 1 To 43
                        If (.Cells(A, B) <> "") And ((.Cells(1, B).Value = -2.21 + C / 10) Or (.Cells(1, B).Value = -2.2 + C / 10)) Then
                            Worksheets("Upchain Edit").Cells(i, C + 1).Value = WorksheetFunction.Convert((.Cells(A, B)), "m", "in")
                            C = 44
                        End If
                    Next C
                Next B
                A = A + 150 '150 skips rows to get down to next 50ft increment
                End If
            Next
    End With
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] loop to copy blank cells between 2 filled cells
    By Spyderwoman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2016, 12:44 AM
  2. [SOLVED] Copy Cells to available blank cells in rows below loop
    By lee1000d in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-17-2015, 02:21 PM
  3. [SOLVED] Skip blank cells in a loop
    By k64 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-14-2013, 02:29 PM
  4. [SOLVED] Help fix my loop to fill in blank cells down a row
    By mellowmarshall in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-14-2013, 01:29 PM
  5. [SOLVED] Find first non-blank cell after a group of blanks copy offset cells, find next blank, loop
    By gwsampso in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-21-2012, 06:11 AM
  6. Loop through a range pasting in Blank Cells
    By luv2bowl2004 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2011, 01:20 PM
  7. how do I skip blank cells when writing formulas
    By KatB in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-11-2006, 05:00 PM

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