VBA code to copy entire row IF a specific word is in a SPECIFIC column
- Haris1977
- Thread is marked as Resolved.
-
-
Hello,
Attached is your file Version 2 ...
Hope this will help
-
Thanks. Will test it tomorrow as i am on a mini sabbatical.
-
Thanks for your feedback
-
Hello again
[USER="31712"]Carim[/USER] well, it actually works but..When i put "OXI" in Sheet1 K4, a number is created in L4 cell. The same happens with Sheet1 K5 (it creates a number in L5 cell). Dunno why. But it works.
On the other hand when i delete the "OXI" from Sheet1 K4 the line inserted on Sheet 2 is not deleted. So, these are my 2 issues. Other than that it seems to work. Can y check those 2 issues?
-
-
Hello,
Let me recap :
1. When you select OXI in Sheet1 cell K4 :
- The Range A:H is copied to Sheet 2
- Next to OXI ... you have the confirmation of the destination row x in Sheet 22. When you delete OXI in Sheet1 cell K4
- The Range A:H which had been copied to Sheet 2 row x gets deleted
- The destination row x which was originally visible in Column L is also deletedHope this clarifies
-
1. Correct.
2. When i delete OXI in Sheet1 cell K4, the range A;H which had been copied earlier to sheet2 row x IS NOT deleted (and i want to automatically been deleted). Can you add a code for that? -
Sorry ...But Range in Sheet 2 gets deleted ... as soon as you delete OXI in Sheet 1
If you can remember the original destination row number .. you will notice the whole row has been deleted ...
Please test again with attached copy ...
-
[USER="31712"]Carim[/USER] hello again friend
It partially works. Make this test:
Put OXI in K4, K5 and K6 in that order. Row 19, 20 is created in sheet2. No line 21 though. I guess there is an error there
Oups: There is a whole line that is missing from your V2 file. I guess you delete it by accident. That made the code not work as excpected
This is the original file to check it again
-
Among all your Columns in Sheet 1 ... could you indicate the one column which holds a Unique Identifier for the record located on a given row ... ?
Since this is all Greek to me ... !!! :?
This will allow a safer identification than the destination row ...
-
-
Well wait. Let me explain my self.
While your code works, it does it - partially.
Just make a test to see what i am talking about:
- Insert an OXI in Sheet's 1 K8 cell (in original.xlsx file which is my original file). It will insert this row as a line 19 in sheet2.
- Now import an OXI in Sheet's 1 K4 cell. It will insert this row as a line 20 in sheet2. Until now the code works as expected.Now delete OXI in K8 cell. While the data of line 19 in sheet2 is gone, the data in line 20 now becomes the data in row 19. That is wrong. The row 19 should remain - but with no data in it.
-
To avoid possible confusions with the row # .... Could you confirm Column A ( ΑΡ.ΚΑΕΚ ) can be used as a Unique Identifier ...
-
Yes it is a unique number. But why do y ask? Will this help you with your code?
-
Yes it is a unique number. But why do y ask? Will this help you with your code?
Yes ... it helps a lot ... since it is only with a Unique Identifier that you can identify where the record is located in Sheet 2 ...
Will prepare the code modification ...
-
Thanks i will wait.
-
-
Attached is Version 3 ...
Let me know if it solves your delete question ... Or not ...
-
Thanks man! That works as expected!!
I know i have become a burden but there is an other issue that i may need your help (if y can help me with this - i would be very grateful :)).
As you can see in sheet1 in J column there are some dates inserted. Those dates are connected with A1 cell (which has the today date. That date in A1 is changing every day). Among with date numbers there are some N/A which is the abbreviation of Not Available data. There are 2 colors also. Red and green (and no color for N/A)
Lets say that the "test" cell is J6 (18/10/2019, which means October 18 of 2019).
I have created this condition: When J6 cell value=$A$1 (that condition applies to the whole J column of course), the specific cell turns into "RED". For cell value>$A$1 the cell becomes green.
Now what i also want is that:
For the red cells, i want this color to remain red UNTIL a "NAI" or "OXI" value is inserted into column K. Only until then the color will change to green (dont forget that with OXI the row is also been copied into sheet2 too of course). In other words if there is a NAI OR NO in K column, then the color of the adjacent cell will turn GREEN
I know that i am a pain in the ass, but is that possible?
-
Thanks man! That works as expected!!
Good to hear your initial request is solved ... :smile:
Thanks for your Thanks ...AND for the Like ...:smile:
As soon I have a moment ... will take a look at your latest requests ...
-
Regarding your question about the rules to be applied for Conditional Formatting ...
Please test Attached Version 4 ....and see if, by modifying cells K6 and K7 ... you are getting your expected results ...
Thanks for your feedback
-
Oh..That seems to work ! Great thanks !:)
-
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!