Problem with Range("a65536").End(xlUp).Offset(1, 0).Value

R

Raj

Hi,

I am writing a report in an excel sheet where I need to keep appending
strings to the cell below the last cell in column A

To achieve this I am using the following line in the code:
ThisWorkbook.Worksheets("Sheet1").Range("a65536").End(xlUp).Offset(1,
0).Value = 25

Can I use a variable to replace the code?:
ThisWorkbook.Worksheets("Sheet1").Range("a65536").End(xlUp).Offset(1,
0).Value

I tried storing it in a range object. But the range determined at set
time remained unhanged. (Please note that I am not using a loop. Hence
I cannot use the incrementing in count variable to set a new range).

Can I use it anyway in a string variable? My own attempts to do this
have not worked.

Any other ideas to do what I want (appending lines) with less verbose
code are also welcome.

Thanks in advance for the help.

Regards,
Raj
 
R

ryguy7272

Find Last Used Cell:
Sub FindLastCell1()
Cells(Rows.Count, "A").End(xlUp).Select
End Sub

Sub FindLastCell2()
Range("A:A").Find("*", Cells(1), _
xlValues, xlWhole, xlByRows, xlPrevious).Select
End Sub

Regards,
Ryan--
 
G

Gary Keramidas

maybe this

Sub test()
Dim wb As Workbook
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

ws.Cells(Rows.Count, "A").End(xlUp).Offset(1).Value = 25


End Sub
 
G

Gary Keramidas

sorry, don't need the workbook declaration

Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Sheet1")

ws.Cells(Rows.Count, "A").End(xlUp).Offset(1).Value = 25


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top