Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.excel.programming > #111161

Re: Search specific columnheading and copy/insert this column to location column A

From GS <gs@v.invalid>
Newsgroups microsoft.public.excel.programming
Subject Re: Search specific columnheading and copy/insert this column to location column A
Date 2019-09-30 12:02 -0400
Organization A noiseless patient Spider
Message-ID <qmt8tu$9a9$1@dont-email.me> (permalink)
References <6aa1fd2b-ba6f-49a0-9a34-4a697076ecae@googlegroups.com> <qmqa2e$5fa$1@dont-email.me>

Show all headers | View raw


A more brief version...

Sub MoveColumn2()
  Dim c As Range

  Set c = ActiveSheet.Range("1:1").Find("ABCD", lookat:=xlPart)
  If Not c Is Nothing Then
    If c.Column = 1 Then
      MsgBox "Heading 'ABCD' is already in column A", vbInformation
    Else
      Columns(c.Column).Cut: Columns(1).Insert Shift:=xlToRight
      MsgBox "Heading 'ABCD' was found and moved to column A", vbInformation
    End If
  Else
    MsgBox "Heading 'ABCD' does not exist", vbExclamation
  End If
End Sub

-- 
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
  comp.lang.basic.visual.misc
  microsoft.public.vb.general.discussion

Back to microsoft.public.excel.programming | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Search specific columnheading and copy/insert this column to location column A JS SL <jmslab@xs4all.nl> - 2019-09-29 05:39 -0700
  Re: Search specific columnheading and copy/insert this column to location column A Claus Busch <claus_busch@t-online.de> - 2019-09-29 15:03 +0200
    Re: Search specific columnheading and copy/insert this column to location column A JS SL <jmslab@xs4all.nl> - 2019-09-29 21:43 -0700
    Re: Search specific columnheading and copy/insert this column to location column A GS <gs@v.invalid> - 2019-09-30 12:02 -0400

csiph-web