Results 1 to 6 of 6

Macro to replace text in column and transfer

Threaded View

  1. #4
    Forum Contributor
    Join Date
    01-28-2010
    Location
    NY
    MS-Off Ver
    Excel 2003
    Posts
    105

    Re: Macro to replace text in column and transfer

    Hi, so I was able to fix that aspect of the above code. Thank You. It runs on all worksheets
    However I keep getting a runtime error 91 : Object variable or with block variable not set
    Wondering how best to fix this

    Sub asda()
    
    Dim q As Integer
    Dim currentsheet As Worksheet
    Dim c As Range, firstaddress As String, a As Long
    Worksheets(1).Activate
    
    For q = 1 To ActiveWorkbook.Worksheets.Count
    Set currentsheet = ActiveWorkbook.Worksheets(q)
    Worksheets(q).Activate
    
    
    With Columns(1)
      Set c = .Find("Investor", LookIn:=xlValues, LookAt:=xlWhole)
      If Not c Is Nothing Then
        firstaddress = c.Address
        Do
          a = a + 1
          If a > 1 Then c = "Holder"
          c.Offset(, 3) = "% of CSO"
          Range("C" & c.Row & ":C" & c.Row + 20).Value = Range("D" & c.Row & ":D" & c.Row + 20).Value
          Set c = .FindNext(c)
        Loop While Not c Is Nothing And c.Address <> firstaddress
        Range(firstaddress) = "Holder"
        
      End If
    End With
    
    Next q
    
    End Sub
    Last edited by undergraduate; 01-12-2011 at 12:07 PM. Reason: Object variable or with block variable not set

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