Move a range of cells if cell in col B is a number

andymalan

Board Regular
Joined
Feb 22, 2017
Messages
128
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
Greetings my dear learned friends,
in the screengrab below I need to determine if cells in Col B is a number. If it is a number, move cells in col B:AS to J74.
Then check the next row, B76. Because B76 is text, skip to B77.
B77 is a number Move B77:AS77 to J76.
Loop through 2500 rows.
Please help me with this I have no idea how to solve this.

1624022186601.png
 

Attachments

  • 1624021808107.png
    1624021808107.png
    80.6 KB · Views: 5

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Will you ever have two consecutive rows with numbers in col B? If so what should happen.
Also do you want to delete the rows after moving the data to the row above?
 
Upvote 0
Will you ever have two consecutive rows with numbers in col B? If so what should happen.
Also do you want to delete the rows after moving the data to the row above?
Hello Fluff
first answer is no.
2nd answer is yes

thirdly thank you thank you thank you.
 
Upvote 0
Ok, how about
VBA Code:
Sub andymalan()
   Dim Cl As Range, Rng As Range
   
   For Each Cl In Range("B2", Range("B" & Rows.Count).End(xlUp)).SpecialCells(xlConstants, xlNumbers)
      Cl.Resize(, 44).Copy Cl.Offset(-1, 8)
      If Rng Is Nothing Then Set Rng = Cl Else Set Rng = Union(Rng, Cl)
   Next Cl
   If Not Rng Is Nothing Then Rng.EntireRow.Delete
End Sub
 
Upvote 0
Solution
Ok, how about
VBA Code:
Sub andymalan()
   Dim Cl As Range, Rng As Range
  
   For Each Cl In Range("B2", Range("B" & Rows.Count).End(xlUp)).SpecialCells(xlConstants, xlNumbers)
      Cl.Resize(, 44).Copy Cl.Offset(-1, 8)
      If Rng Is Nothing Then Set Rng = Cl Else Set Rng = Union(Rng, Cl)
   Next Cl
   If Not Rng Is Nothing Then Rng.EntireRow.Delete
End Sub
Hello Fluff
that worked a treat. Thank you so much.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,272
Members
449,075
Latest member
staticfluids

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