ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete all of collumn after cell... (https://www.excelbanter.com/excel-programming/344158-delete-all-collumn-after-cell.html)

Zlord[_4_]

Delete all of collumn after cell...
 

Alright, we all know how to do this. How do I put it into code?
This is what my employer told me.

1. go to the column B
2. hit <end <down and it goes to the last student.
3. hit <Down arrow once more (puts cursor below last active record).
4. Select EVERY row from there to <end<Down (bottom of exce
sheet)
5. <right click and DELETE


How on earth do I do this in VBCode

--
Zlor
-----------------------------------------------------------------------
Zlord's Profile: http://www.excelforum.com/member.php...fo&userid=2751
View this thread: http://www.excelforum.com/showthread.php?threadid=48028


Gary Keramidas

Delete all of collumn after cell...
 
try recording a macro as you perform the steps

--


Gary


"Zlord" wrote in
message ...

Alright, we all know how to do this. How do I put it into code?
This is what my employer told me.

1. go to the column B
2. hit <end <down and it goes to the last student.
3. hit <Down arrow once more (puts cursor below last active record).
4. Select EVERY row from there to <end<Down (bottom of excel
sheet)
5. <right click and DELETE


How on earth do I do this in VBCode?


--
Zlord
------------------------------------------------------------------------
Zlord's Profile:
http://www.excelforum.com/member.php...o&userid=27519
View this thread: http://www.excelforum.com/showthread...hreadid=480285




Leith Ross[_146_]

Delete all of collumn after cell...
 

Hello Zlord,

Like this...

FIND THE NEXT CELL AFTER THE LAST RECORD..
StartCell = Cells(Rows.Count, "B").End(xlUp).Offset(1, 0).Address

FIND THE LAST CELL ON THE WORKSHEET..
LastCell = Cells(Rows.Count, "B").Address

SELECT THE THE CELLS TO BE DELETED..
Range(StartCell, LastCell).Select

DELETE THE CELLS..
Selection.Delete[/color]

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=48028



All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com