Skip to main content
Support is Offline
Today is our off day. We are taking some rest and will come back stronger tomorrow
Official support hours
Monday To Friday
From 09:00 To 17:30
  Sunday, 08 December 2019
  0 Replies
  1.5K Visits
0
Votes
Undo
I need help! I am trying to create a worksheet to help at work except I am not really computer literate.  I used an existing code that was magical except for a minor tweek that I cannot seem to edit successfully.  I need to move data from a selection on Sheet 1 based on a value to Sheet 2.  I need the code to delete within a specific range and not the entire row. I have other data on the row that I don't want deleted.  I have named the range on Sheet 1 to "RESTORATION" (=Sheet1!$A$15:$F$54) hoping that I could incorporate the name within the code. I don't know how to change the code to move and delete information within named range "RESTORATION".  This is the original code that I need to edit:
Sub
Cheezy()
'Updated by Kutools for Excel 2017/8/28
    
Dim
xRg 
As
Range
    
Dim
xCell 
As
Range
    
Dim
As
Long
    
Dim
As
Long
    
Dim
As
Long
    
I = Worksheets(
"Sheet1"
).UsedRange.Rows.Count
    
J = Worksheets(
"Sheet2"
).UsedRange.Rows.Count
    
If
J = 1 
Then
       
If
Application.WorksheetFunction.CountA(Worksheets(
"Sheet2"
).UsedRange) = 0 
Then
J = 0
    
End
If
    
Set
xRg = Worksheets(
"Sheet1"
).Range(
"C1:C"
& I)
    
On
Error
Resume
Next
    
Application.ScreenUpdating = 
False
    
For
K = 1 
To
xRg.Count
        
If
CStr
(xRg(K).Value) = 
"Done"
Then
            
xRg(K).EntireRow.Copy Destination:=Worksheets(
"Sheet2"
).Range(
"A"
& J + 1)
            
xRg(K).EntireRow.Delete
            
If
CStr
(xRg(K).Value) = 
"Done"
Then
                
K = K - 1
            
End
If
            
J = J + 1
        
End
If
    
Next
    
Application.ScreenUpdating = 
True
End
Sub
There are no replies made for this post yet.