• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Find Replace

sanket.katkar

New Member
Actually I want to select Row 12 - 28 of Column E, and then i have to perform Find and replace. In find i write the last row number of the previous sheet and replace with next row number of that sheet. So for Eg: if i have 2 worksheet name KPI and Email. I select the rows from email sheet anf perform find and replace option by ctrl+H and in find I write the last row number of KPI sheet and replace with the next row number of KPI sheet.

so can you suggest the code. as in macro i get the last row number of the KSI sheet which is stored in a variable.
 
Seems like an odd request, but here's the code. Note that there's no error checking to make sure there is a previous sheet, so if you try to run this when the first worksheet is selected, it will crash.

[pre]
Code:
Sub CustomFind()
Dim LastRow As Integer
With Worksheets(ActiveSheet.Index - 1)
'Last row of which column?
'For now, I'll assume col A
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With

ActiveSheet.Range("E12:E28").Replace what:=LastRow, replacement:=LastRow + 1, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False

End Sub
[/pre]
 
now im stuck up in new problem,

Actually im copying the data from one column and pasting special values in other column that is working fine , but when i perform this task after pasting it should increment that original column by one.

Example:

Suppose i am copying data from column E i.e. Week 34 - 12 as the header. to column D.

So its pasting the same but after pasting it should increament week 34 - 12 to Week 35 - 12 in column E only..


Can anyone help me out ....
 
Back
Top