Range in macro

jaystang93

New Member
Joined
Sep 17, 2018
Messages
2
Hello, I've inherited an Excel macro at work that I need to update. I am somewhat familiar with VBA but far from being an expert. Here is a snippet of the code I would like to ask about:

If Len(bad_data_temp) = 0 Then
bad_data_temp = arr1(i, 1) & " in row " & i & "@@@@@Range(" & column_number & i
End If

I don't understand what the Range and column_number is doing. What is the purpose of the "@" sign and why are there 5 of them? What is the "(" at the end of the Range doing? I tried Google but I couldn't find any information about this. Thanks for any help you can provide.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Hmmmmmmmm
If i = 2 , arr(i, 1) = "Information" and column_number = 3

then bad_data_temp would = "Information in row 2 @@@@@Range(32" looks a bit odd. What do you need it to do?
 
Upvote 0
Hi,

Here is more code. This macro checks sure that users enter data correctly. For example, this part checks for gender.

'validate Gender
For i = 1 To LastLine Step 1
If i > 2 Then
If Len(arr1(i, 1)) > 0 Then
If arr1(i, 1) <> "MALE" And _
arr1(i, 1) <> "FEMALE" Then
bad_data_in_field = bad_data_in_field + 1
If Len(bad_data_temp) = 0 Then
bad_data_temp = arr1(i, 1) & " - in row # " & i & "@@@@@Range(" & column_num & i
End If
End If
End If
End If


The macro generates a small report letting the user know what's wrong so they can fix it. For example, if I entered "ZZZZZ" for gender, it would create a report on a different tab. This is the exact error message in two columns.
gender ZZZZZ - in row # 3
 
Upvote 0

Forum statistics

Threads
1,224,943
Messages
6,181,921
Members
453,071
Latest member
Gizmo2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top