Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7435387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:03:56+00:00 2026-05-29T10:03:56+00:00

Below is my excl data: A B c … F G 1 test vb1

  • 0

Below is my excl data:

A    B       c  ... F               G

1   test    vb1     testing1        open
2   test1   vb2     testing1        close
2   test2   vb3     testing1 
4   test3   vb4     testing1

I want to move F column data to B column and shift B column data to right; so before B will be C.

How can I do with this using Excel VBA programming?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:03:57+00:00Added an answer on May 29, 2026 at 10:03 am

    Try this:

    Option Explicit
    
    Sub MoveColumns()
    
    With ActiveSheet
        .Columns("F:F").Cut
        .Columns("B:B").Insert Shift:=xlToRight
        .Columns("C:C").Cut
        .Columns("E:E").Insert Shift:=xlToRight
    End With
    Application.CutCopyMode = False
    End Sub
    

    To use this:

    • open the Visual Basic Editor: Tools > Macro > Visual Basic Editor
    • insert a module (right-click on VBAProject and Insert > Module)
    • paste the above code in this new module.

    You can then execute the code from Excel: Tools > Macro… > Macros…

    [EDIT] Another try without copy-pasting

    Option Explicit
    
    Sub copyWithArray()
    Dim lLastrow As Long
    Dim aValues As Variant
    
    With ActiveSheet
        lLastrow = .Cells(.Rows.Count, "AE").Row
        'store data from the column F
        aValues = .Range("F1:F" & lLastrow).Value
        '"move" data a column further
        .Range("C1:AE" & lLastrow).Value = .Range("B1:AD" & lLastrow).Value
        'copy data from column C to column B
        .Range("B1:B" & lLastrow).Value = .Range("C1:C" & lLastrow).Value
        'restore data copied from column F to column B
        .Range("B1:B" & lLastrow).Value = aValues
    End With
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

below is my code for confirmation dialog and sending data with ajax. In this
Below are the data in a column of my database: ABC;123; TGH DEF;123456; TFG
Below is the runloop for my secondary NSThread* processThread To close the thread I
Below is my sample data.MY environment is centos and I have run this command
Below is a test page. If I go through all the JQM 'pages' and
Below I have a very simple example of what I'm trying to do. I
Below are two ways of reading in the commandline parameters. The first is the
Below is my current char* to hex string function. I wrote it as an
Below is part of the XML which I am processing with PHP's XSLTProcessor :
Below is my $.ajax call, how do I put a selects (multiple) selected values

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.