Results 1 to 6 of 6

Small macro need to modify

Threaded View

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    BD
    MS-Off Ver
    Microsoft Office 2016
    Posts
    640

    Small macro need to modify

    Dear all , separately below macro runs very well
    
    Sub FillBlanks()
    'With Sheets(2)
    
    For Each vCell In Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row).Cells
    If vCell = "" Then
    Range(vCell.Address).Value = Range(vCell.Address).Offset(-1, 0).Value
    End If
    Next vCell
    
    'End With
    
    End Sub
    But if I add another macro together like below

    Sub bse()
    
    Sheets(1).Columns("A:A").Copy Sheets(2).Range("B1")
    LastRow = Sheets(2).Range("B" & Rows.Count).End(xlUp).Row
    Sheets(2).Range("A1").Formula = "=IF(ISNUMBER(SEARCH(""@"",B1)),RIGHT(B1,5),B1)"
    Sheets(2).Range("A2").Resize(LastRow).Formula = "=IF(ISNUMBER(SEARCH(""@"",B2)),RIGHT(B2,5),A1)"
    Sheets(2).Range("A1:A50000").Value = Sheets(2).Range("A1:A50000").Value
    Sheets(2).Columns("B:B").TextToColumns Destination:=Range("B1"), DataType:=xlFixedWidth, _
            FieldInfo:=Array(Array(0, 1), Array(17, 1), Array(35, 1)), TrailingMinusNumbers _
            :=True
    
    'Sub FillBlanks()
    'With Sheets(2)
    
    For Each vCell In Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row).Cells
    If vCell = "" Then
    Range(vCell.Address).Value = Range(vCell.Address).Offset(-1, 0).Value
    End If
    Next vCell
    
    'End With
    
    End Sub
    Then I got error in the following line
    Range(vCell.Address).Value = Range(vCell.Address).Offset(-1, 0).Value
    Run-time error ‘1004’
    Application-defined or object-defined error
    Last edited by nur2544; 11-12-2013 at 09:56 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Functions similar to SMALL or overcome limitations of SMALL
    By arvindtechie in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-05-2013, 10:59 AM
  2. Stop Macro, Check Cells & Modify if Necessary, Resume Macro
    By AccountantCost in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-08-2009, 07:39 AM
  3. Replies: 3
    Last Post: 08-11-2008, 09:21 AM
  4. need small help with a macro please
    By excelguru in forum Excel General
    Replies: 3
    Last Post: 11-13-2006, 12:22 AM
  5. Small Macro
    By tbobo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-23-2006, 01:40 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