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

  • Home
  • SEARCH
  • 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 6203273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:53:10+00:00 2026-05-24T04:53:10+00:00

I have A column and B column, They compare their previous values And Iam

  • 0

I have A column and B column, They compare their previous values And Iam comparing it with the following formulae

    =IF((OR(AND(A2=A1,B2=B1),K2=0),0,1) it puts the 0 or 1 on the coresponding Q column

so when it goes to the 5th cell then it becames

    =IF((OR(AND(A5=A4,B5=B4),K5=0),0,1)

But im trying to apply it in my VBA code like these

  For numm = 2 To lastRow
  Sheet1.Cells(numm, "Q").Value = ="IF(OR(AND(sheet1.cells(numm,""A"").value=sheet1.cells(numm-1,""A"")simlar way becolumn),sheet1.cells(numm,""k"").value=0),1,0)"
  Next numm

But Im unable to peform the action it says 1004 error and object error
How do i use cells(numm,”A”) in my VBA formulae or atleast any other way to put my formula and make it work

  • 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-24T04:53:11+00:00Added an answer on May 24, 2026 at 4:53 am

    The reference to the looping numm within your formula needs to be out of the string.

    Maybe you can set in VBA the cell formula itself…

    For numm = 2 To lastRow
    
        Sheet1.Cells("Q" & numm).Formula = _
             "=IF((OR(AND(A" & numm & "=A" & numm - 1 & ",B" & numm & _
             "=B" & numm - 1 & "),K" & numm & "=0),0,1)"
    
    Next numm
    

    Personally, I’d do the whole statement within VBA (ifs, ors, ands) and just drop the value back to Excel. Using Excel formulas makes the code harder to read.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a few windwos services. They get xml column from Sql server manipulate
I have a table with several employees. They have the following columns empid,datecolumn1,is_valid. Very
I have column with varchar values like 022008 that I need to convert into
I have the following function which compares the first column value in two 2D
I have a column 'name' in Database which has values as 'john,smith'. I'm passing
I have three tables with 5 columns each. They can grow upto 15 rows
I have a table that stores employee names and years they worked. The columns
I have two excel files. Among many columns in both these files, they have
I have 3 database tables, all of them have the same 5 columns. They
I have column named summary (tinytext, utf8_turkish_ci). I know it can store 255 byte

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.