Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default help with a macro needed

is there a way with a macro to delete contents (text) of some cells in a
column, and all other adjacent cells move over one column to the left ? eg:
H I J K L M N O P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
m -1 90 G R 5 54 43 12.24
g -2 85 H T 5 54 43 12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

should be as follows:

H I J K L M N O P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
-1 90 G R 5 54 43 12.24
-2 85 H T 5 54 43 12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

down to 300 rows . the text in some cells are in random rows but always in
column H
i'm not familiar with VBA and i use excel 2000

thank you all
regards bill gras


--
bill gras
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default help with a macro needed

Bill

This macro will do it:

Sub Macro1()
For Each C In ActiveSheet.UsedRange.Columns("H").Cells
If Not IsNumeric(C.Value) Then
C.Delete Shift:=xlToLeft
End If
Next
End Sub

Disclaimer: I take no responsibility for lost data.
Complaint form: . (Try to fit any complaints in the black area!)

"bill gras" wrote in message
...
is there a way with a macro to delete contents (text) of some cells in a
column, and all other adjacent cells move over one column to the left ?
eg:
H I J K L M N O
P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
m -1 90 G R 5 54 43 12.24
g -2 85 H T 5 54 43
12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

should be as follows:

H I J K L M N O
P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
-1 90 G R 5 54 43 12.24
-2 85 H T 5 54 43 12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

down to 300 rows . the text in some cells are in random rows but always in
column H
i'm not familiar with VBA and i use excel 2000

thank you all
regards bill gras


--
bill gras



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default help with a macro needed

Hi Bill,

Try:

'==============
Public Sub Tester02()
Dim Rng As Range
Dim LRow As Long

LRow = Cells(Rows.Count, "H").End(xlUp).Row

Set Rng = Range("H2:H" & LRow)

On Error Resume Next
Rng.SpecialCells(xlCellTypeConstants, 2). _
Delete Shift:=xlToLeft
On Error GoTo 0
End Sub

'==============


---
Regards,
Norman



"bill gras" wrote in message
...
is there a way with a macro to delete contents (text) of some cells in a
column, and all other adjacent cells move over one column to the left ?
eg:
H I J K L M N O
P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
m -1 90 G R 5 54 43 12.24
g -2 85 H T 5 54 43
12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

should be as follows:

H I J K L M N O
P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
-1 90 G R 5 54 43 12.24
-2 85 H T 5 54 43 12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

down to 300 rows . the text in some cells are in random rows but always in
column H
i'm not familiar with VBA and i use excel 2000

thank you all
regards bill gras


--
bill gras



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default help with a macro needed

Hi Bill James and Norman Jones
Thank You for your swift reply and your help
regards Bill Gras
--
bill gras


"Norman Jones" wrote:

Hi Bill,

Try:

'==============
Public Sub Tester02()
Dim Rng As Range
Dim LRow As Long

LRow = Cells(Rows.Count, "H").End(xlUp).Row

Set Rng = Range("H2:H" & LRow)

On Error Resume Next
Rng.SpecialCells(xlCellTypeConstants, 2). _
Delete Shift:=xlToLeft
On Error GoTo 0
End Sub

'==============


---
Regards,
Norman



"bill gras" wrote in message
...
is there a way with a macro to delete contents (text) of some cells in a
column, and all other adjacent cells move over one column to the left ?
eg:
H I J K L M N O
P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
m -1 90 G R 5 54 43 12.24
g -2 85 H T 5 54 43
12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

should be as follows:

H I J K L M N O
P
-1 40 D H 5 54 43 32.64
-6 22 G R 5 54 43 25.60
-1 90 G R 5 54 43 12.24
-2 85 H T 5 54 43 12.04
-3 80 H C 5 54 43 16.86
-6 34 G K 5 54 43 18.51

down to 300 rows . the text in some cells are in random rows but always in
column H
i'm not familiar with VBA and i use excel 2000

thank you all
regards bill gras


--
bill gras




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro help needed :( [email protected] Excel Worksheet Functions 2 April 7th 08 03:06 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
MACRO NEEDED AshMorK Excel Discussion (Misc queries) 7 November 27th 06 05:47 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 10:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"