Need to add info to different worksheet

Boardbud

New Member
Joined
Jun 21, 2011
Messages
4
I know this looks a little messy but it is working for what I need thus far. My issue is instead of having a set location("D3") to place the account name on a different worksheet I need it to search the range from D3 down and add it in where there is an empty line. What do you think?
Code:
Sub addAccountSheet()
    Dim putinData As Long
    Application.ScreenUpdating = False
    Sheets("Account Template").Visible = True
    Sheets("Account Template").Copy After:=Sheets("Journal")
    ActiveSheet.Name = fmAddAccount.lbxAccount.Value
    Sheets(fmAddAccount.lbxAccount.Value).Select
    Range("B2").Value = fmAddAccount.lbxAccount.Value
    Sheets("Account Template").Visible = False
    putinData = Sheets("Data Sheet").Range("D" & Rows.Count).End(xlUp).Row
    Sheets("Data Sheet").Range("D3").Value = fmAddAccount.lbxAccount.Value
    Application.ScreenUpdating = True
    fmAddAccount.Hide
End Sub
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try:
Code:
Sub addAccountSheet()
    Dim putinData As Long

    Application.ScreenUpdating = False

    With Sheets("Account Template")
           .Visible = True
           .Copy After:=Sheets("Journal")
    End With

    ActiveSheet.Name = fmAddAccount.lbxAccount.Value
    Range("B2").Value = fmAddAccount.lbxAccount.Value
    putinData = Sheets("Data Sheet").Range("D" & Rows.Count).End(xlUp).Row
    Sheets("Data Sheet").Range("D3").End(xlDown).Offset(1,0) = fmAddAccount.lbxAccount.Value
    Sheets("Account Template").Visible = False 
    Application.ScreenUpdating = True
    fmAddAccount.Hide

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,678
Members
452,937
Latest member
Bhg1984

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