Select visible cell before a particular cell

ks1987

New Member
Joined
Aug 8, 2012
Messages
24
Hi,

I am writing a VBA code, where I need to copy the visible cell before AF53 from multiple files and paste them in another file. For that I need to figure out how to select the particular cell as it may be in different columns in one or the other file

Thanks in advance
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You can loop backwards from column 32 (AF) to find the last visible cell. The syntax would be:

Code:
Sub Find_Visible()
Dim i As Integer
    For i = 31 To 1 Step -1
        If Columns(i).EntireColumn.Hidden = False Then
            ' Your Code Here<YOUR Code>
            Exit For
        End If
    Next
End Sun
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,511
Messages
6,125,250
Members
449,218
Latest member
daynle

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