Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to extract the data in a certain cell


Hi Guys,

I'm trying to come up with a macro program to get the Sequence no. (in
bold font) and write it in column C. In Colum A I have the data below,
In Column B I have the Incident number and In column C i wish to write
the extracted nubmers from Column A. I was thinking that the word
Sequence no. can be used as a search item so that excel will know that
the number below it is the number that needs to be written on column
C.

I hope you can respond to this i have been working for hours to get
this running but I haven't really got any success so far.

Thanks in advance.


Description
Vendor/Supplier:XXXXXXXXX
Invoice no.
Sequence no.
10024350
10024370
Vendor/Supplier: XXXXXXXXXX
Invoice no.
SKU/PLU No. 8888010101618
8888010101601
Sequence No.
13016989

Vendor/Supplier: XXXXXXXXXX
Invoice No.
Sequence no.
3036940
Product code No. 1256453119465
Qty: 24
Vendor/Supplier: XXXXXXXXXX
Credit note. CN126140
Sequence no.
25022191

Vendor/Supplier: Diethelm Singapore
Credit note. 1950201830
Sequence no.
13016989


--
Eladamri
------------------------------------------------------------------------
Eladamri's Profile: http://www.excelforum.com/member.php...o&userid=35099
View this thread: http://www.excelforum.com/showthread...hreadid=559205

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to extract the data in a certain cell


Hi Guys

I really hope you can help me with this one.
:confused

--
Eladamr
-----------------------------------------------------------------------
Eladamri's Profile: http://www.excelforum.com/member.php...fo&userid=3509
View this thread: http://www.excelforum.com/showthread.php?threadid=55920

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Macro to extract the data in a certain cell

Assuming each record is in a single cell in column A and each is separated
by vbLf, this may work<no error handling and not tested:

Public function GetSeq(argRange as range) as string
Dim Data as variant
dim i as long
data=split(argrange.value,vblf)
for i=1 to ubound(data)
if lcase(data(i))="sequence no." then
getseq=data(i+1)
exit function
end if
next
getseq="No Seq"
End function

NickHK

"Eladamri" wrote in
message ...

Hi Guys,

I'm trying to come up with a macro program to get the Sequence no. (in
bold font) and write it in column C. In Colum A I have the data below,
In Column B I have the Incident number and In column C i wish to write
the extracted nubmers from Column A. I was thinking that the word
Sequence no. can be used as a search item so that excel will know that
the number below it is the number that needs to be written on column
C.

I hope you can respond to this i have been working for hours to get
this running but I haven't really got any success so far.

Thanks in advance.


Description
Vendor/Supplier:XXXXXXXXX
Invoice no.
Sequence no.
10024350
10024370
Vendor/Supplier: XXXXXXXXXX
Invoice no.
SKU/PLU No. 8888010101618
8888010101601
Sequence No.
13016989

Vendor/Supplier: XXXXXXXXXX
Invoice No.
Sequence no.
3036940
Product code No. 1256453119465
Qty: 24
Vendor/Supplier: XXXXXXXXXX
Credit note. CN126140
Sequence no.
25022191

Vendor/Supplier: Diethelm Singapore
Credit note. 1950201830
Sequence no.
13016989


--
Eladamri
------------------------------------------------------------------------
Eladamri's Profile:

http://www.excelforum.com/member.php...o&userid=35099
View this thread: http://www.excelforum.com/showthread...hreadid=559205



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro to extract the data in a certain cell


Hi NickHK,

I still receive an error
Compile Error:
Expected End Sub

But thank you very much for your help. I Greatly appreciate your help

--
Eladamr
-----------------------------------------------------------------------
Eladamri's Profile: http://www.excelforum.com/member.php...fo&userid=3509
View this thread: http://www.excelforum.com/showthread.php?threadid=55920

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Macro to extract the data in a certain cell

You can't get that error as it is a Function, not a Sub.
Look elsewhere in you code for a missing "End Sub".

NickHK

"Eladamri" wrote in
message ...

Hi NickHK,

I still receive an error
Compile Error:
Expected End Sub

But thank you very much for your help. I Greatly appreciate your help.


--
Eladamri
------------------------------------------------------------------------
Eladamri's Profile:

http://www.excelforum.com/member.php...o&userid=35099
View this thread: http://www.excelforum.com/showthread...hreadid=559205





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Macro to extract the data in a certain cell


"Eladamri" wrote in
message ...

Hi Guys,

I'm trying to come up with a macro program to get the Sequence no. (in
bold font) and write it in column C. In Colum A I have the data below,
In Column B I have the Incident number and In column C i wish to write
the extracted nubmers from Column A. I was thinking that the word
Sequence no. can be used as a search item so that excel will know that
the number below it is the number that needs to be written on column
C.

I hope you can respond to this i have been working for hours to get
this running but I haven't really got any success so far.

Thanks in advance.


Description
Vendor/Supplier:XXXXXXXXX
Invoice no.
Sequence no.
10024350
10024370
Vendor/Supplier: XXXXXXXXXX
Invoice no.
SKU/PLU No. 8888010101618
8888010101601
Sequence No.
13016989


Maybe something like this:

Sub Sequence()
Dim SequenceFollows As Boolean

For Each cell In Selection
If SequenceFollows = True And IsNumeric(cell.Offset(0, -2)) Then
cell.Value = cell.Offset(0, -2).Value
Else
SequenceFollows = False
End If
If LCase(cell.Offset(0, -2)) = "sequence no." Then SequenceFollows =
True
Next cell
End Sub

The macro assumes that you have selected cells in column C. It then searches
all cells 2 columns to the left (column A), sets an internal flag if it
finds the word "Sequence No. (you should be consistent in your spelling -
you changed capitalization in your example) and then extracts the following
numbers up to the next non-numeric value.

Good luck.

Joerg




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 Extract Template Data to New Worksheet CaymanCarrie Excel Worksheet Functions 0 January 25th 08 07:11 PM
Creating a Macro Button to Extract Data william4444 Excel Discussion (Misc queries) 1 July 3rd 06 02:04 PM
Creating a Macro Button to Extract Data william4444[_2_] Excel Programming 4 July 3rd 06 04:24 AM
Creating a Macro Button to Extract Data william4444 New Users to Excel 0 June 22nd 06 02:53 AM
Macro to extract data Bill A Excel Discussion (Misc queries) 3 February 15th 06 12:30 PM


All times are GMT +1. The time now is 02:40 PM.

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

About Us

"It's about Microsoft Excel"