ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Code modification help please (https://www.excelbanter.com/excel-programming/386049-code-modification-help-please.html)

Chris Hankin[_4_]

Code modification help please
 
Hello,

Could some one please help me modify the following vba code so that I
can enter string-text into column A instead of a long-number?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim lrowA As Long
Dim lrowH As Long

lrowA = Cells(Rows.Count, "A").End(xlUp).Row
lrowH = Cells(Rows.Count, "H").End(xlUp).Row

If lrowH < lrowA Then
For i = lrowH + 1 To lrowA
Cells(i, "H").FillDown
Next
End If

End Sub

Any help would be greatly appreciated.

Thanks,

Chris.



*** Sent via Developersdex http://www.developersdex.com ***

JE McGimpsey

Code modification help please
 
Not sure what you mean - this code doesn't prevent using text in column
A. It wouldn't require longs in any case - all numbers in XL cells are
doubles.

What is the problem you're experiencing?

In article ,
Chris Hankin wrote:

Hello,

Could some one please help me modify the following vba code so that I
can enter string-text into column A instead of a long-number?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim lrowA As Long
Dim lrowH As Long

lrowA = Cells(Rows.Count, "A").End(xlUp).Row
lrowH = Cells(Rows.Count, "H").End(xlUp).Row

If lrowH < lrowA Then
For i = lrowH + 1 To lrowA
Cells(i, "H").FillDown
Next
End If

End Sub

Any help would be greatly appreciated.

Thanks,

Chris.



*** Sent via Developersdex http://www.developersdex.com ***


Chris Hankin[_4_]

Code modification help please
 
Hello JE McGimpsey, thanks for your reply. The problem I was
experiencing was that my spreadsheet was 'protected' and thus causing a
run-time error '1004'. I have left my spreadsheet 'unprotected' and am
able to populate text into column A.

Kind regards,

Chris.

*** Sent via Developersdex http://www.developersdex.com ***


All times are GMT +1. The time now is 06:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com