![]() |
problem with replace command
in this macro i am trying to find and replace data in the rows of a
particular column (25th). can someone guide me where im going wrong? Sub ReplaceData() Dim x As Integer For x = 2 To 40000 Cells(x, 25).Select cell.Value = Replace(cell.Value, "FALSE", "FAL") Next x End Sub this code gives an overflow error |
problem with replace command
Try
Sub ReplaceData() Dim x As Long For x = 2 To 40000 Cells(x, 25).Value = Replace(Cells(x, 25).Value, "FALSE", "FAL") Next x End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "ruchie" wrote in message ups.com... in this macro i am trying to find and replace data in the rows of a particular column (25th). can someone guide me where im going wrong? Sub ReplaceData() Dim x As Integer For x = 2 To 40000 Cells(x, 25).Select cell.Value = Replace(cell.Value, "FALSE", "FAL") Next x End Sub this code gives an overflow error |
problem with replace command
You defined x as an integer. Integers don't up to 40000. Change it to a Long.
Hope this helps, Hutch "ruchie" wrote: in this macro i am trying to find and replace data in the rows of a particular column (25th). can someone guide me where im going wrong? Sub ReplaceData() Dim x As Integer For x = 2 To 40000 Cells(x, 25).Select cell.Value = Replace(cell.Value, "FALSE", "FAL") Next x End Sub this code gives an overflow error |
problem with replace command
thanks a ton Chip! it worked now!!!
|
problem with replace command
Cells(x, 25).Value = Replace(Cells(x, 25).Value, "", "TRU")
should this work to replace blanks as well? |
problem with replace command
If IsEmpty(Cells(x, 25).Value) Then Cells(x, 25).Value = "TRU"
-- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "ruchie" wrote in message ups.com... Cells(x, 25).Value = Replace(Cells(x, 25).Value, "", "TRU") should this work to replace blanks as well? |
All times are GMT +1. The time now is 04:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com