OfficeUser
Well-known Member
- Joined
- Feb 4, 2010
- Messages
- 544
- Office Version
- 365
- 2016
- Platform
- Windows
I am currently using this code to plot out cell locations based on where I enter info into a cell. So for example if I put a letter into cell G25, then the corresponding grid coordinates would be D-3 and then that would be placed into the next empty cell under A33.
When I started using this code I never had info upto A57. After that all rows were hidden. I have since added more rows and now when I plot, my coordinates fall into the first empty cell of column A, cell A68. How do I get it go back to looking at the first empty cell under A33? Thanks.
When I started using this code I never had info upto A57. After that all rows were hidden. I have since added more rows and now when I plot, my coordinates fall into the first empty cell of column A, cell A68. How do I get it go back to looking at the first empty cell under A33? Thanks.
Code:
Sub Plots(Target)
Dim Grid As Range
Dim Locus As String
Dim NextCell As Range
Dim R As Long, C As Long
Set Target = Target.Cells(1, 1)
Set Grid = Range("C20:AA28")
If Not Intersect(Target, Grid) Is Nothing And Not IsError(Target.Value) Then
If Target.Value <> "" Then
Set NextCell = Cells(Rows.Count, "A").End(xlUp)
If NextCell.Row < 33 Then Set NextCell = Range("A33")
R = Target.Row
C = Target.Column
NextCell.Offset(1, 0) = Cells(R, "B") & "-" & Cells(29, C)
End If
End If
Set Target = Target.Cells(1, 1)
Set Grid = Range("AC20:BC28")
If Not Intersect(Target, Grid) Is Nothing And Not IsError(Target.Value) Then
If Target.Value <> "" Then
Set NextCell = Cells(Rows.Count, "AD").End(xlUp)
If NextCell.Row < 33 Then Set NextCell = Range("AD33")
R = Target.Row
C = Target.Column
NextCell.Offset(1, 0) = Cells(R, "B") & "-" & Cells(29, C)
End If
End If
End Sub