+ Reply to Thread
Results 1 to 2 of 2

Fill blank cells

  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?
    Please Login or Register  to view this content.
    Last edited by 3Sixty; 11-06-2005 at 01:29 PM.

  2. #2
    Rowan Drummond
    Guest

    Re: Fill blank cells

    I haven't worked through all the code but you seem to be refering to the
    range rSearchRange before you set it to anything:

    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
    ...

    Hope this helps
    Rowan

    3Sixty wrote:
    > 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?
    >
    > Code:
    > --------------------
    >
    > 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
    >
    > --------------------
    >
    >


+ Reply to Thread

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