Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default if cell is text move left one column

ColB is a long list with sections names followed by category codes
I need to move the text into colA leaving colB with codes only (all numbers)
ColB.
Doors
940590
555998
447006
447008
810697
810705
810706
810707
Windows
619435
525691
525692

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default if cell is text move left one column

Try

Sub Macro1()
Dim lngRow As Long
For lngRow = 1 To Cells(Rows.Count, "B").End(xlUp).Row
If Not IsNumeric(Range("B" & lngRow)) Then
Range("A" & lngRow).Value = Range("B" & lngRow).Text
Range("B" & lngRow).Value = ""
End If
Next
End Sub

--
Jacob


"Saintsman" wrote:

ColB is a long list with sections names followed by category codes
I need to move the text into colA leaving colB with codes only (all numbers)
ColB.
Doors
940590
555998
447006
447008
810697
810705
810706
810707
Windows
619435
525691
525692

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default if cell is text move left one column

Hi,

Try this

Sub Merge()
Set sht = Sheets("Sheet1") ' Change to suit
lastrow = sht.Cells(Cells.Rows.Count, "B").End(xlUp).Row
Set MyRange = sht.Range("B1:B" & lastrow)
For Each c In MyRange
If Not IsNumeric(c.Value) Then
c.Offset(, -1).Value = c.Value
c.ClearContents
End If
Next
End Sub

--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Saintsman" wrote:

ColB is a long list with sections names followed by category codes
I need to move the text into colA leaving colB with codes only (all numbers)
ColB.
Doors
940590
555998
447006
447008
810697
810705
810706
810707
Windows
619435
525691
525692

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
Move curser left one cell Patrick C. Simonds Excel Programming 2 May 14th 08 11:43 PM
if cell text repeats, move the adjacent column to the same row ILoveMyCorgi Excel Programming 5 April 8th 08 11:06 PM
How do I Move column A, B, etc. to left side. TeesPlus New Users to Excel 1 February 24th 06 07:32 PM
Getting Range to move 1 column left and resize by 1 mozart[_4_] Excel Programming 1 August 24th 05 08:39 AM
move y-axis labels on column chart from left to right side Kaye Charts and Charting in Excel 3 June 3rd 05 12:59 PM


All times are GMT +1. The time now is 06:48 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"