-
Fill first Empty cell in column When second column has an entry inserted
<div>Here is my problem, I hope I explain this well. I have a value that when my macro runs it looks to see if there is a value in cell X4 if there is, it moves the value to column G and inserts it in cell G2. This works fine, problem is though column E keeps track of all inserts and when this runs last item in Column G loses item number count. I need to have the block find the first empty cell in column E when X moved to G and increase the number by one.<br><br>My existing block<br><br>If IsEmpty(Range("X4").Value) = False Then</div><div> Range("G2").Select</div><div> Selection.Insert Shift:=xlDown</div><div> Range("X4").Select</div><div> Selection.Cut</div><div> Range("G2").Select</div><div> ActiveSheet.Paste</div><div> </div><div> End If<br><br>I have used this formula below, before in another setting and it works fine on its own. However if I try to add it in, between activesheet.paste and End if I get an error on the last line.<br><br><div> Dim LastRow As Long</div><div>LastRow = ActiveSheet.Range("E" & Rows.Count).End(xlUp).Row</div><div>ActiveSheet.Cells(LastRow + 1, "E").Value = ActiveSheet.Cells(LastRow, "E").Value + 1<br><br>I need it run in the same sub as the first block.<br>Any help is appreciated.</div></div><br>
-
This thread moved to Excel. Posted here by mistake
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules