Data from Second column to previous column if condition meet

Vishaal

Well-known Member
Joined
Mar 16, 2019
Messages
533
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
Thanks in advance,

we have the following data:-

Book1
ABCDEFGHIJKLMNOPQRS
1idS.No.CATEGORYBOOK TITLE (Roman)BOOK CODEBOOK PRICEAuthor name EnglishLanguageSUBJECTBindingPublisherStockStock/Out of stockPage No.Length (CM)Width (CM)Height (CM)Weight
2
39789389668TestingHow to win7926320.00Editorial BoardEnglishCOMPETITION BOOKSpaperbackPRAKASHAN50Stock35627.319.51.3549
49789389668Testingprace more self6926315.00Editorial BoardEnglishCOMPETITION BOOKSpaperbackPRAKASHAN50StockOut of Stock38027.319.51.5579
59789389668Testingmaster the skill5962650.00Editorial BoardEnglishCOMPETITION BOOKSpaperbackPRAKASHAN50Stock48027.319.50.8280
69789389668TestingC++ programme3926450.00Editorial BoardEnglishCOMPETITION BOOKSpaperbackPRAKASHAN50Stock38027.319.50.5150
Hindi


its a sample data, we have large data in that we want to VBA/Excel will check and if find the value "Out of Stock" in column N, it will cut from here and paste in previous column. i mean in sample data like M4 will be change to "Out of Stock"
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Can column N have anything other than "Out of Stock" in it?
 
Upvote 0
Ok, how about
Rich (BB code):
Sub vishaal()
   With Range("N2:N" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(xlConstants)
      .Offset(, -1).Value = .Value
      .ClearContents
   End With
End Sub
Remove the line in blue if you don't want to remove the value from col N
 
Upvote 0
Thanks Fluff ji
I will check and update u

Thanks for the help



Ok, how about
Rich (BB code):
Sub vishaal()
   With Range("N2:N" & Range("A" & Rows.Count).End(xlUp).Row).SpecialCells(xlConstants)
      .Offset(, -1).Value = .Value
      .ClearContents
   End With
End Sub
Remove the line in blue if you don't want to remove the value from col N
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,561
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top