Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro Find value & insert

Hi I need some code to look for names in column 3, which match name in
range a1, then if it does inserting value in column 4 from range b2.
Thats it !
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro Find value & insert

Sub findNcpy()
Dim c As Range
For Each c In Range("C" & Cells(Rows.Count, 3).End(xlUP).Row)
If c = Range("A1").Value Then
c.Offset(0 2) = Range("B4").Value
End If
Next
End Sub

"wazzo" wrote:

Hi I need some code to look for names in column 3, which match name in
range a1, then if it does inserting value in column 4 from range b2.
Thats it !

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro Find value & insert

Hi,

Right click your sheet tab, view code and past this in and run it

Sub marine()
lastrow = Cells(Rows.Count, "C").End(xlUp).Row
Set myrange = Range("C1:C" & lastrow)
For Each c In myrange
If c.Value = Range("A1").Value Then
c.Offset(, 1).Value = Range("B2").Value
End If
Next


Mike


"wazzo" wrote:

Hi I need some code to look for names in column 3, which match name in
range a1, then if it does inserting value in column 4 from range b2.
Thats it !

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro Find value & insert

I'm sure you meant this or something similar :)

For Each c In Range("C1:C" & Cells(Rows.Count, 3).End(xlUp).Row)

Mike

"JLGWhiz" wrote:

Sub findNcpy()
Dim c As Range
For Each c In Range("C" & Cells(Rows.Count, 3).End(xlUP).Row)
If c = Range("A1").Value Then
c.Offset(0 2) = Range("B4").Value
End If
Next
End Sub

"wazzo" wrote:

Hi I need some code to look for names in column 3, which match name in
range a1, then if it does inserting value in column 4 from range b2.
Thats it !

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Macro Find value & insert

Yes I did mean that. Mike. Thanks. Old age is catching up with me.
I had it right in my module for testing but neglected to correct the line
that I had priviously put on Note Pad to copy. Stuff happens:)

"Mike H" wrote:

I'm sure you meant this or something similar :)

For Each c In Range("C1:C" & Cells(Rows.Count, 3).End(xlUp).Row)

Mike

"JLGWhiz" wrote:

Sub findNcpy()
Dim c As Range
For Each c In Range("C" & Cells(Rows.Count, 3).End(xlUP).Row)
If c = Range("A1").Value Then
c.Offset(0 2) = Range("B4").Value
End If
Next
End Sub

"wazzo" wrote:

Hi I need some code to look for names in column 3, which match name in
range a1, then if it does inserting value in column 4 from range b2.
Thats it !

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
Formula, Macro, or VBA code to find and insert Keith Excel Worksheet Functions 3 October 2nd 09 08:21 PM
Macro - Find Next Change In A Column; then insert row masterbaker Excel Programming 5 July 9th 07 05:48 PM
Find & Replace and Find & Insert macro help needed RS Excel Programming 2 January 29th 07 07:35 AM
Excel Macro find non zero value in cell and insert row beneath TimkenSteve Excel Programming 5 September 14th 06 07:26 PM
Macro To Find Data And Insert Row quinla01 Excel Programming 2 February 15th 06 04:18 PM


All times are GMT +1. The time now is 04:21 AM.

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

About Us

"It's about Microsoft Excel"