+ Reply to Thread
Results 1 to 2 of 2

Syntax error in 9-line macro ..?

Hybrid View

thh3 Syntax error in 9-line macro... 03-30-2008, 06:13 PM
rylo Hi Try Sub USD() ... 03-30-2008, 06:31 PM
  1. #1
    Registered User
    Join Date
    03-30-2008
    Posts
    1

    Syntax error in 9-line macro ..?

    Hi there, I have some C++ programming experience but none in VB, can anyone please tell me what's wrong with this macro?

    Sub USD() 
         For i = 1 To 415 
              For j = 1 To 5 
                  Dim X As String = Cells(i, j).Value 
                  Dim aString As String = Replace(X, " USD", "") 
    	      Cells(i, j) = aString 
              Next j 
         Next i 
    End Sub

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    Try

    Sub USD()
      Dim X As String
      Dim aString As String
         For i = 1 To 415
              For j = 1 To 5
                  X = Cells(i, j).Value
                  aString = Replace(X, " USD", "")
            Cells(i, j) = aString
              Next j
         Next i
    End Sub

    rylo

+ 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