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 6615667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:29:27+00:00 2026-05-25T20:29:27+00:00

I have to go through the complete A column and check if cell value

  • 0

I have to go through the complete A column and check if cell value length is < 6 then delete it.

I used to perform the operations on the sheet like this

 activesheet.range("A" & row_number).select
 selection.entirerow.delete

As people suggested using a variant I want to work with variants.

I have taken a set of range into a variant.

 dim var as variant 
 var=sheet1.range("A1:D1000").value

Suppose I have 20 rows whose cell value length in A column is less than 6. I have to remove these 20 rows in the variant variable, including the other corresponding columns in variant that is B, C, D. I mean var(“A18:D18”) should be completely removed.

I heard people say we can’t delete an entry from a variant, we should take a new variant and copy only those values into the new variant. If that is the situation how do I copy one variant to another variant?

For rows whose A column cell value length is greater than 6, cell values should be converted into a standard format. I have done it using the sheet like

activesheet.cells("some cell!).value=activesheet.cells("").value

I loop through each row and it is taking some time as every time I’m knocking the sheet for values. I want to use variants now, take the complete range, perform the operation and write it back.

How to remove the complete row that we entered into variant like var(“A2:D2”), then copy the var(“A4:D4”) value to other variant like var2(“A6:D6”)?

Can we also insert an entry into variant at the middle of the variant like we insert row in the sheet?

  • 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-25T20:29:28+00:00Added an answer on May 25, 2026 at 8:29 pm

    Something like this

    1. It takes A1:D1000 on the first worksheet (array X)
    2. Tests each column A cell to see if it is longer than 6 characters
    3. If it is greater than 6 then the entire row (4 cells in your case) is written as a
      new row in array Y
    4. The reduced array is written to A1 in the sexcond worksheet
    5. Added formatting of sheet1 columns to sheet2 columns

      Sub VarExample()
      Dim ws1 As Worksheet
      Dim ws2 As Worksheet
      Set ws1 = ActiveWorkbook.Sheets(1)
      Set ws2 = ActiveWorkbook.Sheets(2)
      Dim X
      Dim Y
      Dim lngRow As Long
      Dim lngCOl As Long
      Dim lngCnt As Long
      'define the size of the array to be processed on sheet 1
      X = ws1.Range("A1:D1000").Value2
      'make the second array the same size as the first
      ReDim Y(1 To UBound(X, 1), 1 To UBound(X, 2))
      'Look at the first record in each row  [,1] part to see if it is longer than 6 chars
      For lngRow = 1 To UBound(X, 1)
          If Len(X(lngRow, 1)) > 6 Then
           'Longer than 6 so add 1 more row to the length of the 2nd array
              lngCnt = lngCnt + 1
              'Loop through value in this row of the first array and place in the second array
              For lngCOl = 1 To UBound(X, 2)
                  Y(lngCnt, lngCOl) = X(lngRow, lngCOl)
              Next lngCOl
          End If
      Next
      'create a range on the second sheet equal in size to the second array and dump the array to it
      ws1.[a1].Resize(UBound(Y, 1), UBound(Y, 2)).Value2 = Y
      'copy formatting
      ws1.[a1].Resize(1, UBound(X, 2)).EntireColumn.Copy
      ws2.[a1].Resize(1, UBound(X, 2)).EntireColumn.PasteSpecial Paste:=xlPasteFormats
      Application.CutCopyMode = False
      End Sub
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want have a query with a column that is a hardcoded value not
Have gone through hibernate api specification on FlushMode but didn't get the exact difference.
I have read through several reviews on Amazon and some books seem outdated. I
I have gone through their developer guide but haven't been able to find a
I have discovered through trial and error that the MATLAB engine function is not
I have read through the solutions to similar problems, but they all seem to
I have gone through different questions/articles on Message Brokers and ESBs(Even on stackoverflow). Still
I have search through the web to figure this out but no luck. I
I have been through every option to try to find a way to get
I have been through the Apple Developer guides and tutorials and I been through

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.