ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pick a row (https://www.excelbanter.com/excel-programming/321031-pick-row.html)

myleslawrence

Pick a row
 
Can anyone tell me how I can I put a value in cell $row$20 where row is the
row with "Summary" in the first column and the column is 20



Nick Hodge

Pick a row
 
Myles

This will do what you want I think

Sub FindSummary()
Dim rRng As Range
Set rRng = Range("A:A").Find("Summary")
If rRng Is Nothing Then
MsgBox "Summary not found"
Exit Sub
End If
rRng.Offset(0, 20).Value = 12345
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
HIS


"myleslawrence" wrote in message
...
Can anyone tell me how I can I put a value in cell $row$20 where row is
the row with "Summary" in the first column and the column is 20




Claud Balls

Pick a row
 
Try this:
sub summary()
for i = 1 to activesheet.usedrange.rows.count
if range("A" & i) = "Summary" then
range(20, i) = "My Value"
end if
next
end sub


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Tom Ogilvy

Pick a row
 
Dim rng as Range, rng1 as Range
Dim res as Variant, lRow as long
set rng = Range("A1:A1000")
res = Application.Match("Summary",rng,0)
if not iserror(res) then
set rng1 = rng(res)
lRow = rng1.Row
cells(lRow,20).Value = "a Value"
End If

--
Regards,
Tom Ogilvy

"myleslawrence" wrote in message
...
Can anyone tell me how I can I put a value in cell $row$20 where row is

the
row with "Summary" in the first column and the column is 20





myleslawrence

Pick a row
 
Thanks to all. This kind of response is terrific!

"Tom Ogilvy" wrote in message
...
Dim rng as Range, rng1 as Range
Dim res as Variant, lRow as long
set rng = Range("A1:A1000")
res = Application.Match("Summary",rng,0)
if not iserror(res) then
set rng1 = rng(res)
lRow = rng1.Row
cells(lRow,20).Value = "a Value"
End If

--
Regards,
Tom Ogilvy

"myleslawrence" wrote in message
...
Can anyone tell me how I can I put a value in cell $row$20 where row is

the
row with "Summary" in the first column and the column is 20








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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com