Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A problem with found a value on a column

Hi there,

I have a little problem making an excel macro, I want that the macro
find the last value (the zero cell) in a column an change this value.

I think that is like

for SearchQuery = . range(A1:A100)
if SearchQuery.Value = "0" Then
SearchQuery.Value = "I found it"
end if

This work fine when I try to change the value of an specific cell, but
I don't know the statements when is a complete column, for the first
zero value

and the coude upstair looks fine, But it doesn't work, could any can
help me?

Thanks for ur comments =)
David Garcia


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default A problem with found a value on a column

Sub tester1()
Dim cell As Range
Set cell = Range("A1")
Do While True
If IsNumeric(cell) Then
If CLng(cell) = 0 Then Exit Do
End If
Set cell = cell.Offset(1, 0)
Loop
cell.Value = "I Found it"


End Sub
--
Regards,
Tom Ogilvy


"Iceman Solope " wrote in
message ...
Hi there,

I have a little problem making an excel macro, I want that the macro
find the last value (the zero cell) in a column an change this value.

I think that is like

for SearchQuery = . range(A1:A100)
if SearchQuery.Value = "0" Then
SearchQuery.Value = "I found it"
end if

This work fine when I try to change the value of an specific cell, but
I don't know the statements when is a complete column, for the first
zero value

and the coude upstair looks fine, But it doesn't work, could any can
help me?

Thanks for ur comments =)
David Garcia


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A problem with found a value on a column

By the way I was tried this two codes but doesn't work, could u help m
plz? :D


Code
-------------------

Sub Searching()
Dim rng As Range
Dim lngRow, lngLastRow As Long
Application.ScreenUpdating = False
Set rng = ActiveCell
lngLastRow = Cells(Rows.Count, 1).End(xlUp).Row
For lngRow = lngLastRow To rng.Row + 1 Step -1
If Cells(lngRow, 1).Value = rng.Value Then
Cells(lngRow, 1).Value = "Che perro"
End If
Next lngRow
Application.ScreenUpdating = True
End Sub

-------------------



Code
-------------------

Sub searching()
Dim rng As Range
Dim lngRow, lngLastRow As Long
Application.ScreenUpdating = False
Set rng = ActiveCell
If Range("c1").End(xlDown).Offset(0, 1).Value = rng.Value Then
Range("c1").End(xlDown).Offset(0, 1).Value = "123"
End If
End Sub

-------------------


--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default A problem with found a value on a column

Neither code sample does anything like what you describe. Might be one
reason they don't work.

--
Regards,
Tom Ogilvy


"Iceman Solope " wrote in
message ...
By the way I was tried this two codes but doesn't work, could u help me
plz? :D


Code:
--------------------

Sub Searching()
Dim rng As Range
Dim lngRow, lngLastRow As Long
Application.ScreenUpdating = False
Set rng = ActiveCell
lngLastRow = Cells(Rows.Count, 1).End(xlUp).Row
For lngRow = lngLastRow To rng.Row + 1 Step -1
If Cells(lngRow, 1).Value = rng.Value Then
Cells(lngRow, 1).Value = "Che perro"
End If
Next lngRow
Application.ScreenUpdating = True
End Sub

--------------------



Code:
--------------------

Sub searching()
Dim rng As Range
Dim lngRow, lngLastRow As Long
Application.ScreenUpdating = False
Set rng = ActiveCell
If Range("c1").End(xlDown).Offset(0, 1).Value = rng.Value Then
Range("c1").End(xlDown).Offset(0, 1).Value = "123"
End If
End Sub

--------------------



---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A problem with found a value on a column

I see that,

I have and specific question, How can I put into my code the "empty
value, because this statement works, but only when the cells have th
specific value, and know, I think it shuld be works on the first cel
that doesn't have the value.


Code
-------------------

Sub Busqueda()
Sheets("hola").Columns(2).Find _
(What:="hola", After:=[B1]).Replace _
What:="hola", Replacement:="Richard"
End Sub

-------------------


thnks for ur fruitfull help
Davi

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default A problem with found a value on a column

I gave you code the does what you describe.

this code won't work. to the best of my knowledge, you can't replace an
empty cell with a value. Also, if you could, you would fill up the whole
column.

--
Regards,
Tom Ogilvy



"Iceman Solope " wrote in
message ...
I see that,

I have and specific question, How can I put into my code the "empty"
value, because this statement works, but only when the cells have the
specific value, and know, I think it shuld be works on the first cell
that doesn't have the value.


Code:
--------------------

Sub Busqueda()
Sheets("hola").Columns(2).Find _
(What:="hola", After:=[B1]).Replace _
What:="hola", Replacement:="Richard"
End Sub

--------------------


thnks for ur fruitfull help
David


---
Message posted from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default A problem with found a value on a column

This code works fine


Code
-------------------

Sub SearchAndReplace()
Range("D1").Select ' or any Cell
Selection.End(xlDown).Select 'Goes down to the last Cell with content (also possible with UP)
ActiveCell.Offset(1, 0).Range("D1").Select 'Goes one row deeper
If ActiveCell.Value = "" Then
ActiveCell.Value = "Che perro"
End If
End Sub

-------------------


By the end of this code run, I am on an active cell that is on the las
empty cell (the ones that I changed), now I want to go to the firs
column, in the row where I am. could any know how can I do this?

Thnks for ur comment :)

David Garci

--
Message posted from http://www.ExcelForum.com

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default A problem with found a value on a column

Sure, but why bother to ask?

--
Regards,
Tom Ogilvy


"Iceman Solope " wrote in
message ...
This code works fine


Code:
--------------------

Sub SearchAndReplace()
Range("D1").Select ' or any Cell
Selection.End(xlDown).Select 'Goes down to the last Cell with content

(also possible with UP)
ActiveCell.Offset(1, 0).Range("D1").Select 'Goes one row deeper
If ActiveCell.Value = "" Then
ActiveCell.Value = "Che perro"
End If
End Sub

--------------------


By the end of this code run, I am on an active cell that is on the last
empty cell (the ones that I changed), now I want to go to the first
column, in the row where I am. could any know how can I do this?

Thnks for ur comment :)

David Garcia


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
colum is not found thats missing a column B how to find it meena Excel Worksheet Functions 1 July 17th 09 10:36 AM
return text value found most frequently in a column globetrotter Excel Worksheet Functions 8 February 8th 09 01:15 PM
Formula to search for given term, and if not found in column to add it to list financier Excel Worksheet Functions 3 July 12th 06 03:12 PM
How to find a row since I found a value in a column? see example [email protected] Excel Worksheet Functions 1 April 25th 06 05:45 PM
Hi-light area based on name found in column A Annette[_3_] Excel Programming 10 April 1st 04 11:05 PM


All times are GMT +1. The time now is 10:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"