Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-18-2016, 10:14 PM
ufopilot ufopilot is offline Find criteria, then paste- code is overwriting data Windows XP Find criteria, then paste- code is overwriting data Office 2007
Novice
Find criteria, then paste- code is overwriting data
 
Join Date: Oct 2015
Posts: 6
ufopilot is on a distinguished road
Default Find criteria, then paste- code is overwriting data

Hi all,
My code is set up to copy a range of data ("B27:B49"), find the corresponding "header"("B97") in row 99 ("B99U99"). Then the copied data will be offset 1 row down from the found header and pasted below it.
The user then will go back to create the next header.
The problem is that it keeps copying the next set of data in the same column (C), even though the header does not (any longer) match the "rngDetailToSearch.Find(What...."
It overwrites the existing data from the last input, and will not move to the next cell in row 99 that actually matches the new header, named in B97.
I could use a second set of eyes to see what I am doing wrong.
Thank you

HTML Code:
Sub PlaceInput()
'ActiveSheet.Unprotect
Dim myDetailFind As Integer
Dim rngDetail As Range
Dim rngDetailToSearch As Range
Dim rngDetailFound    As Range
Set wks = ActiveSheet
Set rngDetailToSearch = ActiveSheet.Range("B99:DU99")
Set rngDetailFound = rngDetailToSearch.Find(What:=wks.Range("B97"), _
         LookIn:=xlValues, LookAt:=xlPart, MatchCase:=False)
If Not rngDetailFound Is Nothing Then
ActiveSheet.Range("B27:B49").Copy
   rngDetailFound.Offset(1, 0).PasteSpecial xlValues
 'MsgBox myFind & " Input has been logged."
Else
End If
Range("B10").ClearContents
Range("B10").Select
'ActiveSheet.Protect
End Sub

Attached Files
File Type: xlsm CPY-PSTE.xlsm (106.2 KB, 8 views)

Last edited by ufopilot; 02-19-2016 at 02:47 AM.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find criteria, then paste- code is overwriting data Using Paste in my VBA code Hdata Word VBA 10 03-25-2019 07:57 AM
Find criteria, then paste- code is overwriting data How to return a value in a data table using vertical and horizontal criteria oswald Excel 1 02-08-2015 02:01 AM
Find criteria, then paste- code is overwriting data Excel VBA Macro - Deleting Specific Data based on criteria MD011 Excel Programming 3 12-10-2014 02:15 AM
Find criteria, then paste- code is overwriting data How to paste the data from one table into the cells of another table, without overwriting anything CClio333 Word Tables 1 08-12-2014 05:17 PM
How to count cells containing data and meet certain criteria AdamNT Excel 1 08-11-2006 11:51 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:59 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft