Results 1 to 6 of 6

Code not giving the ouptut but syntactically correct

Threaded View

  1. #1
    Registered User
    Join Date
    01-10-2014
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    10

    Question Code not giving the ouptut but syntactically correct

    Hi,

    Please help with the below code, which removes the blank cells, by replacing
    the values from the below cells to the blank cells, and makes values in sequence for a cloumn.


    Private Sub CommandButton3_Click()
    
    Dim rng As Range, counter As Integer, i As Integer, j As Integer
    
    Set rng = Range("A1:A12")
    
    
    counter = 0
    
    
    For i = 1 To rng.count
    
    If Cells(i, 1).Value = "" Then
    
        For j = i + 1 To rng.count
            If Cells(j, 1).Value = "" Then
            counter = j
            End If
        Next j
     Cells(i, 1).Value = Cells(counter + 1).Value
    
    End If
    
    Next i
    
    End Sub
    Last edited by Veena Anoohya; 02-01-2014 at 01:32 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] SUMIF not giving me the correct answer
    By Cathy Brausa in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-27-2012, 02:05 AM
  2. [SOLVED] End(xlDwon).Row Not giving the correct value
    By WarEagleWire in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-20-2012, 11:35 AM
  3. Vlookup not giving correct number ?
    By novicetony in forum Excel General
    Replies: 4
    Last Post: 03-30-2010, 04:35 PM
  4. Countif not giving correct number
    By anilkumar.n in forum Excel General
    Replies: 5
    Last Post: 01-06-2009, 03:30 AM
  5. Replies: 0
    Last Post: 09-23-2008, 02:03 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