Go Back   Pace and Cap - Sartin Methodology & The Match Up > Sartin Methodology Handicapping 101 (102 ...) > Previous 'Handicapping Discussion' Forum
Get RDSSMark Forums Read
Google Site Search Get RDSS Sartin Library RDSS FAQs Conduct Register Site FAQ Members List Search Today's Posts

Previous 'Handicapping Discussion' Forum General Handicapping Discussion

Reply
 
Thread Tools Display Modes
Old 05-02-2008, 04:27 PM   #1
gl45
Grade 1
 
Join Date: Jun 2005
Posts: 878
vba

Anyone,
why this code isn't working:

Sub Blank()
Range("B3:HZ14").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft
End Sub

I'm trying to delete all the blank cells in the sheet (Range B3:HZ14), and move the data to the left, in order to have a continuous cells that contains only data, to be specific:

b=Blank cell
D=Data cell

Before delete
B C D E F (columns)...etc.
3 b b b b D D D b
4 D b D b b D D D
5 b b b b b b D b
6 D D D D D D D b
7 b b D D b b b b

After delete
B C D E F (columns)...etc.
3 D D D
4 D D D D D
5 D
6 D D D D D D D
7 D D

The workbook already contains macro that only effect the first sheet. The above macro does work with the first sheet named BOX, but I need the macro to work on a sheet named OUT.
Anyone VBA guru?
Thanks
lbj
gl45 is offline   Reply With Quote
Old 05-02-2008, 11:49 PM   #2
TheProgrammer
AlwNW3X
 
Join Date: Apr 2008
Posts: 37
Just select the sheet you want to change first (example):

Worksheets("BOX").Select
Range("B3:HZ14").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft


Worksheets("OUT").Select
Range("B3:HZ14").SpecialCells(xlCellTypeBlanks).Delete Shift:=xlToLeft


RK
__________________
If living life were easy, everyone would be doing it. - anon
TheProgrammer is offline   Reply With Quote
Old 05-03-2008, 08:23 AM   #3
gl45
Grade 1
 
Join Date: Jun 2005
Posts: 878
Randy,
Thank you
lbj
gl45 is offline   Reply With Quote
Old 05-03-2008, 09:10 AM   #4
gl45
Grade 1
 
Join Date: Jun 2005
Posts: 878
Randy,
as usual it never works the first time.
It does open the OUT sheet, but doesn't delete the blanks. Strange.
lbj
gl45 is offline   Reply With Quote
Old 05-03-2008, 10:09 AM   #5
TheProgrammer
AlwNW3X
 
Join Date: Apr 2008
Posts: 37
That's weird, your code worked perfectly for me.

RK
__________________
If living life were easy, everyone would be doing it. - anon
TheProgrammer is offline   Reply With Quote
Old 05-03-2008, 10:15 AM   #6
gl45
Grade 1
 
Join Date: Jun 2005
Posts: 878
Randy,
I will copy/paste to a new workbook, and then run the macro. See if it works.
Thanks,
lbj
gl45 is offline   Reply With Quote
Old 05-03-2008, 10:18 AM   #7
TheProgrammer
AlwNW3X
 
Join Date: Apr 2008
Posts: 37
If it doesn't, could you send me the two sheets and I will try on my end?

Thanks...RK
__________________
If living life were easy, everyone would be doing it. - anon
TheProgrammer is offline   Reply With Quote
Old 05-03-2008, 10:34 AM   #8
gl45
Grade 1
 
Join Date: Jun 2005
Posts: 878
Randy,
thanks a bunch.
lbj
gl45 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.

All times are GMT -4. The time now is 09:03 AM.