Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks a ton Chip! it worked now!!!
|
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Cells(x, 25).Value = Replace(Cells(x, 25).Value, "", "TRU")
should this work to replace blanks as well? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Find and Replace Command | Excel Discussion (Misc queries) | |||
Replace menu command not working | Excel Discussion (Misc queries) | |||
where is the search/replace command located | Excel Worksheet Functions | |||
replace cut command | Excel Programming | |||
replace command | Excel Discussion (Misc queries) |