View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Oamya Kim Oamya Kim is offline
external usenet poster
 
Posts: 1
Default Record Macro in Excel, run macro untill last column

Hi,
I want to record macro to perform some functions (e.g., simple funtion as
below).
I'd like to hv result shown in column B according to input data from col A,
but the below macro only run up to certain number of rows (here is 4 rows)
only.

How about If I input data at column A up to 100 rows, or sometimes 5000 rows,

Pls anyone help me, which additional VBA code i should add ii order to run
the macro up to numbers of rows at each time.

col A col B
Items Test
BHAKSJDDKF =left(A2,5)
BHEKJFKJG
BHM5FGF
BHPKRG


Sub AddPrefix()

Range("B2").Select
ActiveCell.FormulaR1C1 = "=LEFT(RC[-1],5)"
Range("B2:B5").Select
Selection.FillDown
End Sub

Pls. help. Thanks a lot