Macro Needed

ironsides

Well-known Member
Joined
Aug 12, 2002
Messages
575
Starts line 7 cols A thru Z

Data in col A is 6 numbers

Formula needed that will

1-Seek last line in col G

2- Print in cell C5 the
four left numbers
of Col A of that last line
 
Last edited:

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Code:
Sub test()
Dim LR As Long
LR = Range("G" & Rows.Count).End(xlUp).Row
Range("C5") = VBA.Left(Range("A" & LR), 4)
End Sub
 
Upvote 0
Code:
Sub test()
Dim LR As Long
LR = Range("G" & Rows.Count).End(xlUp).Row
Range("C5") = VBA.Left(Range("A" & LR), 4)
End Sub

I made some changes



Sub Cfive()
'
' Cfive Macro
' Macro recorded 9/20/2011 by DCS Valued Customer
'
Dim LR As Long
LR = Range("f" & Rows.Count).End(x1up).Row
Range("C5") = VBA.Left(Range("b" & LR), 4)
'
End Sub

and get this error message
cant execute code is break mode
yellow highlighted in my bold face line
what do i need to adjust

also is there a notation needed to start count cell F7 downward
 
Last edited:
Upvote 0
I made some changes



Sub Cfive()
'
' Cfive Macro
' Macro recorded 9/20/2011 by DCS Valued Customer
'
Dim LR As Long
LR = Range("f" & Rows.Count).End(x1up).Row
Range("C5") = VBA.Left(Range("b" & LR), 4)
'
End Sub

and get this error message
cant execute code is break mode
yellow highlighted in my bold face line
what do i need to adjust

also is there a notation needed to start count cell F7 downward
Change "x1up" to "XLUP"
 
Upvote 0
Why 'F'? There's no mention of that in the first post.
I Made an error in specifying col G it should have been col F
and I also changed my original col A to col B
Mybad? If yes, please excuse me.
Is there a solution with these two changed cols?
 
Upvote 0
I used...

Code:
LR = Range("f" & Rows.Count).End(xlUp).Row

...with no error.

I still get the same error message here's the complete notation

Sub Cfive()
'
' Cfive Macro
' Macro recorded 9/20/2011 by DCS Valued Customer
'
Dim LR As Long

LR = Range("f" & Rows.Count).End(xlUp).Row
Range("C5") = VBA.Left(Range("b" & LR), 4)
'
End Sub

what in the above would cause the break mode error message
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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