473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

simple macro

Oli
Hi

I need a simple excel macro that searches the first 1000 rows, column A
only, of the active worksheet and all text past the first space of each cell
is copied into the B column. Any ideas?

Cheers
Oli
Jul 17 '05 #1
1 1567
Following VBA code will do what you want:

Sub PartialCopyAToB()

Dim strA As String
Dim strB As String
Dim sht As Excel.Worksheet

Dim i As Integer
Dim intSpace As Integer

Set sht=ThisWorkbook.ActiveSheet

For i = 1 To 1000
strA = sht.Cells(i, 1)
intSpace = InStr(1, strA, " ")
If intSpace > 0 Then
strB = Mid(strA, intSpace + 1)
Else
strB = strA
End If
sht.Cells(i, 2) = strB
Next

End Sub

HTH

"Oli" <ol*@NOSPAMoliwoods.co.uk> wrote in message
news:bt**********@sparta.btinternet.com...
Hi

I need a simple excel macro that searches the first 1000 rows, column A
only, of the active worksheet and all text past the first space of each cell is copied into the B column. Any ideas?

Cheers
Oli

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jacek Generowicz | last post by:
:::Title::: A simple text markup utility :::/Title::: :::Section Introduction ::: I'm looking for something to help developers wirte documentation for bits of software they are writing. The...
4
by: Asif | last post by:
Hi there, I have been trying to understand the behaviour of char (*pfn)(null) for a couple of days. can some body help me understand the behaviour of char (*pfn)(null) in Visual C++ environment?...
5
by: Rob Somers | last post by:
Hey all I am writing a program to keep track of expenses and so on - it is not a school project, I am learning C as a hobby - At any rate, I am new to structs and reading and writing to files,...
8
by: Ross A. Finlayson | last post by:
I'm trying to write some C code, but I want to use C++'s std::vector. Indeed, if the code is compiled as C++, I want the container to actually be std::vector, in this case of a collection of value...
2
by: tonytony24 | last post by:
Hi All: I was wondering if there's a simple way to call a MS Access Module through either Command Prompt MS Script any other way... Thanks for the response.
0
by: Chris Thomasson | last post by:
Here is a "simple" method for using the preprocessor to generate code via. recursion... What do you think of my experimental recursion implementation? Can you compile it? Any comments are...
0
by: derelict | last post by:
Hey all, im getting desperate now. I have a macro running in Word 2003, when I run the macro it *should* put a 'bottom' cell border in each cell that has the style used - this included a border at...
176
by: nw | last post by:
Hi, I previously asked for suggestions on teaching testing in C++. Based on some of the replies I received I decided that best way to proceed would be to teach the students how they might write...
1
by: Chris Thomasson | last post by:
I was wondering if the following technique will produce undefined behavior: _______________ #include <cstdio> #define CALL_MACRO_FUNCTION(func_ptr)func_ptr() #define MY_MESSAGE() "Press...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.