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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:58:59+00:00 2026-06-13T09:58:59+00:00

I am currently trying to program a macro. I am writing the macro in

  • 0

I am currently trying to program a macro.

  • I am writing the macro in a new black workbook (this is part of the requirement) and I have a lot of data in a different workbook.
  • I need to use the macro to read the data in that different workbook and spit out errors encountered for each column and write it in the blank workbook (that i am programming macro in).
  • So for each column it’s suppose to have list of row numbers an error was encountered (and nothing else). I’m trying to write an If statement to do this and i keep getting an error message stating “expected then or go to”.

This is what I have so far:

If [Dataset1.xls]Data1!R2C1=53 AND [Dataset1.xls]Data1!R2C1=453 AND [Dataset1.xls]Data1!R2C1=953 Then

The dataset1.xls is the workbook that holds all the data and Data1 is the sheet in that workbook with all the data. I might be accessing the separate workbook totally wrong. Can you guys please help. Thank you very much in advance.

This is most of the code:

Dim numrow As Long
Dim count As Long
count = 2

With Workbooks("Dataset1.xls").Sheets("Data1")
numrow = .Range("A1", .Range("A1").End(xlDown)).Rows.count

End With
Do Until count = numrow
If [Dataset1.xls]Data1!R2C1<>53 AND [Dataset1.xls]Data1!R2C1<>453 AND [Dataset1.xls]Data1!R2C1<>953 Then  

End If
count = count + 1
Loop
  • 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-06-13T09:59:00+00:00Added an answer on June 13, 2026 at 9:59 am

    You should change

    If Workbooks("Dataset1.xls").Sheets("Data1").Cells(2, 1).Value <> 53 AND Workbooks("Dataset1.xls").Sheets("Data1").Cells(2, 1).Value <> 453 AND Workbooks("Dataset1.xls").Sheets("Data1").Cells(2, 1).Value <> 953 Then
    

    Instead of:

    If [Dataset1.xls]Data1!R2C1<>53 AND [Dataset1.xls]Data1!R2C1<>453 AND [Dataset1.xls]Data1!R2C1<>953 Then
    

    Regards

    — full code:

    range = Workbooks("Dataset1.xls").Worksheets("Data").Range("A65536").End(xlUp).Row
    
    For i = 2 To range
    
    If Workbooks("Dataset1.xls").Sheets("Data1").Cells(i, 1).Value <> 53 AND Workbooks("Dataset1.xls").Sheets("Data1").Cells(i, 1).Value <> 453 AND Workbooks("Dataset1.xls").Sheets("Data1").Cells(i, 1).Value <> 953 Then
    
    End IF
    
    Next i
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to optimize my program. I have a large database which consists
I am currently trying to build a program where I have a recursive function
I have a cd , dvd. book media program. Currently, i am trying to
I'm currently trying to have my C program read Unix arguments from the user.
I am currently trying to make a Writing program. I would like the functionality
I am currently trying to write a program that alphabetizes strings. I have one
I am currently trying to get my program to input data from a user-defined
I'm currently trying to pass a mono threaded program to multithread. This software do
i'm currently (trying) to program a little game. And i have a small design/deadlock
I'm writing a matrix program and am currently trying to multiply a point and

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.