Results 1 to 2 of 2

Fill blank cells

Threaded View

  1. #1
    Registered User
    Join Date
    11-06-2005
    Posts
    1

    Fill blank cells

    I am in need of some help. I am new to VBA programming and in need to find a way to copy a value from column D and paste it in column E in the blank cells between two values in the column. I am also trying to delete columns 5 & 6 after I copy and paste the values. The row deletion works by itself, the trouble is pasting in the blanks cells. Here is the code I have - what am I doing wrong?
    Sub Delete_Empty_Rows()
    Dim i As Long
    Dim c As Range
      Dim rSearchRange As Range
      For i = rSearchRange.Row.Count To 1 Step -1
       Set c = Worksheets("VALUES").UsedRange.Columns(4).Find("Sort Program:", LookIn:=xlValues)
       If WorksheetFunction.CountIf(c) Then
       c.SpecialCells(xlCellTypeConstants).Copy
       If WorksheetFunction.CountBlank(c) Then
       c.SpecialCells(xlCellTypeConstants).PasteSpecial
       Next i
       
      Set rSearchRange = Worksheets("VALUES").UsedRange.Columns(6) 'for example
      If WorksheetFunction.CountBlank(rSearchRange) Then _
         rSearchRange.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
         Set rSearchRange = Worksheets("VALUES").UsedRange.Columns(5) 'for example
      If WorksheetFunction.CountBlank(rSearchRange) Then _
         rSearchRange.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
    End Sub
    Last edited by 3Sixty; 11-06-2005 at 01:29 PM.

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