error: 'Duplicate Declaration in current scope'

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
727
Office Version
  1. 2019
Platform
  1. Windows
Hello,
Is there another code to use (lOne) so I don't receive the error and doesn't affect the outcome?
lOne for the first and ??? for the second.

I can post additional coding if necessary.

error: 'Duplicate Declaration in current scope'

1st use:
VBA Code:
lOne:
    Set xRg = Range("B3", Range("B3").End(xlDown))
    xEndRow = xRg.Rows.Count + xRg.Row
    Application.ScreenUpdating = False
    For I = xRg.Rows.Count To 1 Step -1

2nd use:
VBA Code:
lOne:
    Set xRg = Range("L3", Range("L3").End(xlDown))
    xEndRow = xRg.Rows.Count + xRg.Row
    Application.ScreenUpdating = False
    For I = xRg.Rows.Count To 1 Step -1

Thank you
 
That error probably isn't caused by the code you have posted, you probably have 2 Dim lines for either xRg, xEndRow or I in the same module (probably I by the rest of your question)
 
Upvote 0
That error probably isn't caused by the code you have posted, you probably have 2 Dim lines for either xRg, xEndRow or I in the same module (probably I by the rest of your question)
After experimenting, I realize that I can remove the code completely and get the same result.
Thank you for the reply.
 
Upvote 0

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