Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Record Macro in Excel, run macro untill last column

Sub AddPrefix()

Range("B2:B" & Range("A" & Rows.Count).End(xlUp).Row).Formula =
"=LEFT(RC[-1],5)"
End Sub


--
Wigi
http://www.wimgielis.be = Excel/VBA, soccer and music


"Oamya Kim" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to enter record number in column A Sandeman[_19_] Excel Programming 4 April 3rd 06 11:35 AM
How do I record a macro to move down and over to specific column VMH Excel Discussion (Misc queries) 2 March 13th 06 05:09 PM
Record Macro - Record custom user actions Sal[_4_] Excel Programming 1 December 23rd 04 03:18 PM
how to count/sum by function/macro to get the number of record to do copy/paste in macro tango Excel Programming 1 October 15th 04 01:16 PM
How to record macro to work on selected column/row? Olezhka Excel Programming 1 March 5th 04 07:30 PM


All times are GMT +1. The time now is 07:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"